fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int score[10],sort[10];
  5.  
  6. for (int i=0; i<10; i++) {
  7. int t;
  8. scanf("%d", &t);
  9. score[i]=t;
  10. sort[i]=t;
  11. }
  12.  
  13. for (int i=0; i<9; i++) {
  14. for (int j = i+1; j<10; j++) {
  15. if (sort[i] < sort[j]) {
  16. int t = sort[i];
  17. sort[i] = sort[j];
  18. sort[j] = t;
  19. }
  20. }
  21. }
  22.  
  23. int ns = sort[8];
  24.  
  25. int np;
  26. for (int i=0; i<10; i++) {
  27. if (score[i] == ns) {
  28. np = i+1;
  29. }
  30. }
  31.  
  32. printf("9位:%d人目\n",np);
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5280KB
stdin
10 30 40 50 20 60 70 80 90 100
stdout
9位:5人目