1023 GPA and GPA
1023 GPA Calculation
Time Limit: 1 s space limit: 128000 KB title level: Bronze Question View running resultsDescription
Description
James finally entered the University Hall. With excitement and enthusiasm, he attended the freshman Conference of the Information Science and Technology College. At the meeting, Professor Mei, President, introduced the calculation method of score in the University:
It should be explained that Komatsu's PK University adopts the credit system learning method. Each course has certain credits, such as 2 points in linear algebra, 5 points in advanced mathematics, and 8 points in College English. After selecting some subjects, as long as James passes the final test (more than 69), he will get the corresponding credits and a score for the course, for example, if Mr. Komatsu scores 60, he will get a score of 0. If Mr. Komatsu scores 99, he will get a score of 4. Mr. Komatsu must earn 145 credits during his four-year career at the university. Mr. Komatsu's GPA score is strongly related to his overseas, research and work conditions. According to Professor Mei, 20% of the faculty of Komatsu went abroad, 60% of the students studied, 15% worked, and 5% dropped out of school. These are based on the GPA score.
After carefully studying this formula, Mr. Komatsu realized that during college, the ideological and political courses that took 2 credits and the linear algebra that took 4 credits would be equally important. 8 credits for College English courses! & Amp; middot; # $! & Middot; # $.
James estimated the approximate score (0-4) that he could get in his freshman year. Please help him calculate the GPA he would get at the end of his freshman year.
Input description
Input Description
Please read the relevant data from the input. The first line of the input includes an integer.N(1& Le;N& Le;10) indicates the number of homework when James is a freshman. ClosedNTwo real numbers per rowA(0& Le;A& Le;8) andB(0& Le;B& Le;4), Indicating the courseCreditsAndScore.
Output description
Output Description
The output contains only one real number,Please retain2Decimal places.
Sample Input
Sample Input
(Ignore the explanation in parentheses)
10
2 3.7 (linear algebra)
0 3 (linear algebra exercises)
5 3.7 (Advanced Mathematics)
0 4 (Advanced Mathematics exercises)
3 3.3 (mechanics)
3 4 (Introduction to computing)
1 4 (Introduction to information science and technology)
2 4 (military theory)
2 4 (modern Chinese history)
2 3.5 (College English I)
Sample output
Sample Output
3.74
1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 double a,b; 5 double c[1001]; 6 double ans; 7 double tot; 8 int main() 9 {10 int n;11 cin>>n;12 for(int i=1;i<=n;i++)13 {14 cin>>a>>b;15 c[i]=a*b;16 tot=tot+a;17 }18 for(int i=1;i<=n;i++)19 {20 ans=ans+c[i]/tot;21 }22 printf("%.2lf",ans);23 return 0;24 }