#include <stdio.h>int main () {puts ("reprint please specify source thank you");p UTS ("http://blog.csdn.net/vmurder/article/details/43449913 ");}
How long does it take to look at test instructions longer than the writing time?
Is Bestcoder a round T1?
I'm not going to write a 4810? ......
Test instructions
Multiple sets of data, each group input n scores ci, Leveli
Then each leveli is a string that corresponds to a fractional Si,
And then, according to the following output,
What the? You asked me the answer? The above test instructions is the puzzle!
Code:
#include <map> #include <string> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define N 100#define eps 1e-5using namespace std;map<string,double>m;double s,sum1, Sum2;string level;int n;void init () {m["A"]=4.0; m["A-"]=3.7; m["B +"]=3.3; m["B"]=3.0; m["B"]=2.7; m["c+"]=2.3; m["C"]=2.0; m["C"]=1.7; m["D"]=1.3; m["D"]=1.0; m["F"]=0;} int main () {freopen ("test.in", "R", stdin), init (); int I,j,k;while (scanf ("%d", &n)!=eof) {Sum1=sum2=0;while (n--) { Cin>>s>>level;if (level== "P" | | level== "N") continue;sum1+=s*m[level];sum2+=s;} if (sum2<eps) puts ("0.00"), Else printf ("%.2lf\n", sum1/sum2);} return 0;}
"HDU4802" GPA C + + grammar basic problem (really blind)