Treasure the new start, freshmen!——中级
1 Sec 32 MB | Markdown 显示标签
简单 (*1100) 数学
424 | 1293 |
通过 | 提交 |
题目描述
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\gt 0)$ courses, the $i$-th course has the credit $C_i$, your score $S_i$, then the result GPA is
$$
GPA = \frac{C_1\cdot S_1+C_2\cdot S_2+\cdots+C_K\cdot S_K}{C_1+C_2+\cdots+C_K}\ (1\le i\le K, C_i\neq 0)
$$
If there is a $S_i\in [0,60)$, The GPA is **always not existed**.
输入格式
The first number $N$ indicate that there are $N$ test cases.
In each case, there is a number $K$ (the total courses number), then $K$ lines followed, each line would obey the format: `CourseName Credits Score`.
- $N\le 101$
- $K\le 100$
- $1\le |CourseName|\le 30$
- $1\le Credits\le 10$
- $0\le Score\le 100$
输出格式
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.**
样例输入 #1
2 3 Algorithm 3 97 DataStruct 3 90 softwareProject 4 85 2 Database 4 59 English 4 81
样例输出 #1
90.10 Sorry!
来源
校庆杯Warm Up