Code: Select all
#include<stdio.h>
int main() {
int ks =0,term1,term2,term3, term4, at1,at2,at3,total, min ,n;
//freopen("input.txt", "r",stdin);
scanf("%d", &n);
for( ; n > 0; n--) {
total = 0;
ks++;
scanf("%d%d%d%d%d%d%d", &term1, &term2, &term3, &term4, &at1, &at2,&at3);
total = term1+term2+term3+term4;
min = at1;
min = min < at2 ? min : at2;
min = min < at3 ? min : at3;
total = total + (( at1 + at2 + at3 - min) / 2.0);
if( total >= 90)
printf("Case %d: %c\n",ks,'A');
else if( total >= 80)
printf("Case %d: %c\n",ks,'B');
else if( total >= 7)
printf("Case %d: %c\n",ks,'C');
else if( total >= 6)
printf("Case %d: %c\n",ks,'D');
else
printf("Case %d: %c\n",ks,'F');
}
return 0;
}