杭电 HDU 1202 The calculation of GPA
来源:互联网 发布:网络语烧钱是什么意思 编辑:程序博客网 时间:2024/05/05 13:45
The calculation of GPA
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21897 Accepted Submission(s): 5028
Problem Description
每学期的期末,大家都会忙于计算自己的平均成绩,这个成绩对于评奖学金是直接有关的。国外大学都是计算GPA(grade point average) 又称GPR(grade point ratio),即成绩点数与学分的加权平均值来代表一个学生的成绩的。那么如何来计算GPA呢?
一般大学采用之计分法
A90 - 100 4 点
B80 - 89 3 点
C70 - 79 2 点
D60 - 69 1 点
E0 - 59 0 点
例如:某位学生修习三门课,其课目、学分及成绩分别为:
英文:三学分、92 分;化学:五学分、80 分;数学:二学分、60分,则GPA的算法如下:
科目 学分 分数 点数 分数×点数
英文 3 92 4 12
化学 5 80 3 15
数学 2 60 1 2
合计 10 29
29/10=2.9
2.9即为某生的GPA
下面有请你写一个用于计算GPA的程序。
一般大学采用之计分法
A90 - 100 4 点
B80 - 89 3 点
C70 - 79 2 点
D60 - 69 1 点
E0 - 59 0 点
例如:某位学生修习三门课,其课目、学分及成绩分别为:
英文:三学分、92 分;化学:五学分、80 分;数学:二学分、60分,则GPA的算法如下:
科目 学分 分数 点数 分数×点数
英文 3 92 4 12
化学 5 80 3 15
数学 2 60 1 2
合计 10 29
29/10=2.9
2.9即为某生的GPA
下面有请你写一个用于计算GPA的程序。
Input
包含多组数据,每组数据的第一行有一个数N,接下来N行每行表示一门成绩。每行有两个实型的数 s,p,s表示这门课的学分,p表示该学生的成绩(百分制)。如果p=-1则说明该学生这门课缺考,是不应该计算在内的。
Output
对每组数据输出一行,表示该学生的GPA,保留两位小数。如果GPA不存在,输出-1。
Sample Input
33 925 802 60
Sample Output
2.90
Author
Speakless
Source
Gardon-DYGG Contest 2
非得说两句 ,妈的,分数是实数,用整型wa n次 也是够了 ,题目有一个没有说清楚的地方就是分数为负一的时候
他的学分该
#include<iostream>using namespace std;int main(){int N;while(cin>>N){double t,score,sum=0, st=0;for(int i=0;i<N;i++){cin>>t>>score;if(score==-1)continue;else if(score>=90&&score<=100){sum+=4*t;st+=t;}else if(score>=80){sum+=3*t;st+=t;}else if(score>=70){sum+=2*t; st+=t;}else if(score>=60){sum+=1*t;st+=t;}else if(score>=0){st+=t;}}if(st)printf("%.2lf\n",sum*1.0/st);elsecout<<-1<<endl;}return 0;}
看来不该加上。
0 0
- 杭电 HDU 1202 The calculation of GPA
- The calculation of GPA HDU杭电1202
- 杭电--1202--The calculation of GPA--水题
- HDU 1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- hdu-1202-The calculation of GPA
- hdu 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- hdu-1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- ACM-最大子矩阵和
- cento6.6安装配置PXE批量安装系统
- 博客百万浏览量之后的扯淡
- php连接数据库的一些总结(希望大家可以回复交流)
- Moodle安装教程以及phpMyAdmin无法访问解决
- 杭电 HDU 1202 The calculation of GPA
- ListView和CheckBox引入问题
- MVC架构Maven项目(三)包结构规划
- Golang goroutine and channel
- Java高薪技术学习总结-01
- H-LDA (Blei C++) 关键代码分析
- 虚拟机的安装和Linux的安装
- 不允许 dllimport 静态数据成员
- How Tomcat Works读书笔记1