fork(1) download
  1. #include <stdio.h>
  2.  
  3. #define NUM 10
  4.  
  5. int main(void){
  6.  
  7. int numbers[NUM],i,j,count;
  8.  
  9. for(i=0;i<NUM;i++){
  10. scanf("%d", &numbers[i]);
  11. }
  12.  
  13. printf("合格者:\n");
  14. for(i=0;i<NUM;i++){
  15. count=0;
  16. for(j=0;j<NUM;j++){
  17. if(numbers[i]<numbers[j]){
  18. count++;
  19. }}
  20. if(count<=2){
  21. printf("%d人目 %d点\n",i+1,numbers[i]);
  22. }}
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5304KB
stdin
86 93 12 56 85 91 54 36 74 99
stdout
合格者:
2人目 93点
6人目 91点
10人目 99点