fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int bangou[10];
  6. int tokuten[10];
  7. int hyouka[10];
  8. int i, goukei = 0, heikin, sa, h;
  9.  
  10. for (i = 0; i < 10; i++) {
  11. scanf("%d %d", &bangou[i], &tokuten[i]);
  12. goukei += tokuten[i];
  13. }
  14. heikin = goukei / 10;
  15. for (i = 0; i < 10; i++) {
  16. sa = tokuten[i] - heikin;
  17.  
  18. if (20 <= sa) h = 0;
  19. else if (10 <= sa) h = 1;
  20. else if (0 <= sa) h = 2;
  21. else if (-20 <= sa) h = 3;
  22. else h = 4;
  23.  
  24. hyouka[i] = h;
  25. }
  26. for (h = 0; h < 5; h++) {
  27. printf("\n評価:%c\n", "SABCF"[h]);
  28. for (i = 0; i < 10; i++) {
  29. if (hyouka[i] == h) {
  30. printf("%d %d\n", bangou[i], tokuten[i]);
  31. }
  32. }
  33. }
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 1680KB
stdin
1 100
2 80
3 77
4 34
5 98
6 0
7 46
8 87
9 36
10 55
stdout
評価:S
1 100
5 98
8 87

評価:A
2 80
3 77

評価:B

評価:C
7 46
10 55

評価:F
4 34
6 0
9 36