1.17(Treasure the new start, freshmen)

描述:

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 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
GPA = (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.

输入:

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 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.

样例输入:

2
3
Algorithm 3 97
DataStruct 3 90
softwareProject 4 85
2
Database 4 59
English 4 81

样例输出:

90.10

Sorry!

翻译:

描述:

背景:

新学期来临,HDU即将迎来50周年庆,不管你的专业是什么,仅仅有些话我想告诉你:“珍惜大学生活和把握时间。”很多人想象的大学生活是多彩多样的,很少压力。但是事实上,大学生活也很忙碌和艰难。假如你想要去掌握课本上学习的知识,一个最好的解决途径是在休闲时间应该花费在个人的学习跟练习,特别是后者。我认为每个像你一样的人应该保持跟你在高中一样的学习态度。

“没有付出就没有回报”,HDU也拥有奖学金,谁能赢得它?这主要取决于学生的GPA(平均绩点)。现在,我告诉你们这个规定,你们的目标是去编程计算出这个GPA。

假如拥有k门课程,第i门课程的学分为Ci,你的成绩为Si,GPA的结果为:

GPA = (C1 * S1 + C2 * S2 +……+Ci * Si……) / (C1 + C2 + ……+ Ci……) (1 <= i <= K, Ci != 0)

假如成绩60>Si>=0,这个GPA不存在。

输入:

第一个数字N表示这有N组样例,在每个样例里,有一个数字K(课程的总数量),后面有K行,每行遵循这个格式:课程名字(长度<=30),学分(<=10),成绩(<=100)。

注意:课程名称没空白,所有的输入是合法的。

输出:

输出以上每种样例的GPA,假如GPA不存在,输出:”Sorry!",否则仅输出GPA的数值,其四舍五入到小数点后两位。有一个空行在两个输出样例之间。

样例输入:
2
3
Algorithm 3 97
DataStruct 3 90
softwareProject 4 85
2
Database 4 59
English 4 81
样例输出:
90.10

Sorry!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值