"HDU4802" GPA C + + grammar basic problem (really blind)

Source: Internet
Author: User

#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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.