A
来源:互联网 发布:php 协程 异步 编辑:程序博客网 时间:2024/05/29 03:14
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.
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.
Notice: There is no blank in the Course Name. All the Inputs are legal
23Algorithm 3 97DataStruct 3 90softwareProject 4 852Database 4 59English 4 81
90.10Sorry!
#include<stdio.h>#include<string.h>int main(){ int n, k, i, j, flag, count=0; double gredits, sum, gpa, score; char course[30]; scanf("%d", &n); while(n--) { gpa=0;sum=0;flag=1; scanf("%d", &k); for(i=0;i<k;i++) { getchar(); scanf("%s%lf%lf", course, &gredits, &score); if(score>=0&&score<60) { flag=0; } gpa+=gredits*score; sum+=gredits; } if(count++) printf("\n"); if(flag) printf("%.2lf\n", (double)gpa/sum); else printf("Sorry!\n"); } return 0;}
阅读全文
0 0
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- a
- A
- A*
- a
- A
- a
- 小结 | C++(二)| 默认成员函数、this指针
- OpenCL版Caffe安装教程
- Visual Studio 2015开了个小玩笑
- 设计模式(4)——原型 Prototype
- Java并发编程:阻塞队列
- A
- 计算机码制--深入理解 原码、反码、补码
- 【LintCode-463】整数排序(Java实现-冒泡排序/选择排序/插入排序)
- leetcode 226. Invert Binary Tree(C语言,二叉树,递归)54
- Java面试宝典-2017
- AI机器学习新手上路-决策树
- 可扩展的对话框
- DHCP服务器典型配置举例(路由应用)
- J