欢迎光临
我们一直在努力

Treasure the new start freshmen

Treasure the new start, freshmen! Time Limit: 1000/1000 MS (Java/Others)????Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 17877????Accepted Submission(s): 5428


Problem Description background:
A new semester comes , and the HDU also meets its 50th birthday. No matter what’s your major, the only thing I want to tell you is:”Treasure the college life and seize the time.” Most people thought that the college life should be colorful, less presure.But in actual, the college life is also busy and rough. If you want to master the knowledge learned from the book, a great deal of 香港vps leisure time should be spend on individual study and practise, especially on the latter one. I think the every one of you should take the learning attitude just as you have in senior school.
“No pain, No Gain”, HDU also has scholarship, who can win it? That’s mainly rely on the GPA(grade-point average) of the student had got. Now, I gonna tell you the rule, and your task is to program to caculate the GPA.
If there are K(K > 0) courses, the i-th course has the credit Ci, your score Si, then the result GPA is <brhsdrjb = (C1 * S1 + C2 * S2 +……+Ci * Si……) / (C1 + C2 + ……+ Ci……) (1 <= i <= K, Ci != 0)
If there is a 0 <= Si < 60, The GPA is always not existed. ?
Input The first number N indicate that there are N test cases(N <= 50). In each case, there is a number K (the total courses number), then K lines followed, each line would obey the format: Course-Name (Length <= 30) , Credits(<= 10), Score(<= 100).
Notice: There is no blank in the Course Name. All the Inputs are legal ?
Output Output the GPA of each case as discribed above, if the GPA is not existed, ouput:”Sorry!”, else just output the GPA value which is rounded to the 2 digits after the decimal point. There is a blank line between two test cases.?
?
Sample Input 23Algorithm 3 97DataStruct 3 90softwareProject 4 852Database 4 59English 4 81 ?
Sample Output 90.10Sorry! ?
Author zl ?
Source 校庆杯Warm Up ?
Recommend linle???|???We have carefully selected several similar problems for you:?? 2060? 2059? 2062? 2056? 2053? #include <stdlib.h>#include <stdio.h>int main(){ int s,t,i; char a[50]; double x,y; double m,n; bool f; double z; scanf(“%d”,&s); while (s–) { f = true; m = 0;n = 0; scanf(“%d”,&t); for (i=0;i<t;i++) { scanf(“%s%lf%lf”,a,&x,&y); if (y<60) f = false; m = m+x; n = n+y*x; } z = n/m; if (f) printf(“%.2lf\n”,z); else printf(“Sorry!\n”); if (s) printf(“\n”); } return 0; }

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。