UVA 11777 - Automate the Grades

Problem PDF

Solution:

#include
int main()
{
    int t1,t2,f,at,ct1,ct2,ct3,c,d,n,i;
    while(scanf("%d",&n)==1)
    {
        for(i=1;i<=n;i++)
        {
        scanf("%d%d%d%d%d%d%d",&t1,&t2,&f,&at,&ct1,&ct2,&ct3);
        if(ct1<=ct2 && ct1<=ct3)
        c=(ct2+ct3)/2;
        else if(ct2<=ct1 && ct2<=ct3)
        c=(ct1+ct3)/2;
        else if(ct3<=ct1 && ct3<=ct2)
        c=(ct1+ct2)/2;
        d=t1+t2+f+at+c;
        if(d>=90)
        printf("Case %d: A\n",i);
        else if(d>=80)
        printf("Case %d: B\n",i);
        else if(d>=70)
        printf("Case %d: C\n",i);
        else if(d>=60)
        printf("Case %d: D\n",i);
        else if(d<60)
        printf("Case %d: F\n",i);
        }
    }
    return 0;
}
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/11777/11777.cpp