Tuesday, April 8, 2014

UVa Solution 11777 - Automate the Grades

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int T1, T2, Final , At, CT1, CT2, CT3, CT, total, test, a[5], i, t;
    scanf("%d", &test);
    for(t=1; t<=test; t++)
    {
        scanf("%d%d%d%d", &T1, &T2, &Final, &At);
        for(i=0; i<3; i++)
        {
            scanf("%d", &a[i]);
        }
        sort(a, a+i);
        CT = a[1]+a[2];
        total = (T1+T2+Final+At+CT/2);
        if(total>=90)
        {
            printf("Case %d: A\n",t);
        }
        else if(total>=80 && total<90)
        {
            printf("Case %d: B\n", t);
        }
        else if(total>=70 && total<80)
        {
            printf("Case %d: C\n", t);
        }
        else if(total>=60 && total<70)
        {
            printf("Case %d: D\n", t);
        }
        else if(total<60)
        {
            printf("Case %d: F\n", t);
        }
    }
    return 0;
}

No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...