Advertisement
Guest User

Untitled

a guest
Apr 4th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char stu[110][30];
  4. int n;
  5. int sch[110];
  6.  
  7. int main() {
  8.     int i, k, t;
  9.     scanf("%d", &n);
  10.     for (i = 0; i < n; i++) {
  11.         scanf("%s %d %d %c %c %d", stu[i] + 5, &stu[i][0], &stu[i][1], &stu[i][2], &stu[i][3], &t);
  12.         stu[i][4] = t + 1;
  13.     }
  14.     for (i = 0; i < n; i++) {
  15.         if (stu[i][0] > 80 && stu[i][4] > 1) sch[i] += 8000;
  16.         if (stu[i][0] > 85 && stu[i][1] > 80) sch[i] += 4000;
  17.         if (stu[i][0] > 90) sch[i] += 2000;
  18.         if (stu[i][0] > 85 && stu[i][3] == 'Y') sch[i] += 1000;
  19.         if (stu[i][1] > 80 && stu[i][2] == 'Y') sch[i] += 850;
  20.     }
  21.     k = 0;
  22.     for (i = 1; i < n; i++)
  23.         if (sch[i] > sch[k])
  24.             k = i;
  25.     printf("%s\n%d\n", stu[k] + 5, sch[k]);
  26.     for (i = 0, k = 0; i < n; i++)
  27.         k += sch[i];
  28.     printf("%d\n", k);
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement