UVa : 11777 (Automate the Grades)


// http://uva.onlinejudge.org/external/117/11777.html

// @BEGIN_OF_SOURCE_CODE

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#define pi acos(-1.0)
#define N 1000000
using namespace std;


int main ()
{
    int testCase;
    scanf ("%d", &testCase);
    int cases = 0;

    while ( testCase-- ) {
        int marks [7];
        for ( int i = 0; i < 7; i++ )
            scanf ("%d", &marks [i]);

        sort (marks + 4, marks + 7);

        double sum = 0;

        for ( int i = 0; i < 4; i++ )
            sum += marks [i];

        sum += ((marks [5] + marks [6]) / 2.0);

        printf ("Case %d: ", ++cases);

        if ( sum >= 90 ) printf ("A");
        else if ( sum >= 80 ) printf ("B");
        else if ( sum >= 70 ) printf ("C");
        else if ( sum >= 60 ) printf ("D");
        else printf ("F");

        printf ("\n");
    }

    return 0;
}

// @END_OF_SOURCE_CODE
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s