HDOJ 1202 The calculation of GPA
来源:互联网 发布:淘宝天下小二是干嘛的 编辑:程序博客网 时间:2024/06/05 14:59
HDACM1202
注意:学分和成绩都是浮点型,GPA不存在,输出-1
import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(); double sSum = 0; double pSum = 0; while (n-->0){ double s = sc.nextDouble(); double p = sc.nextDouble(); if (p==-1) { continue; } sSum += s; if (p<60) { continue; } if (p<70) { pSum += s; }else if(p<80) { pSum += s*2; }else if (p<90) { pSum += s*3; }else if(p<=100){ pSum += s*4; } } if (sSum==0) { System.out.println(-1); }else{ System.out.printf("%.2f",pSum/sSum); System.out.println(); } } }}
阅读全文
0 0
- HDOJ 1202 The calculation of GPA
- HDOJ 1202 The calculation of GPA
- HDOJ 1202 The calculation of GPA
- HDOJ 1202 The calculation of GPA
- hdoj 1202 the calculation of GPA(水题)
- The calculation of GPA 1202
- 1202 The calculation of GPA
- The calculation of GPA
- The calculation of GPA
- The calculation of GPA
- HDU 1202 The calculation of GPA
- hdu 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- Problem : 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
- 技术团队领导者定位
- Javaweb-xml编程-Jaxp解析xml文档
- 【Opencv】树莓派配置Opencv 3.2 + Raspicam (二) 编译Opencv 3.2 + Raspicam
- 03组件的生命周期和事件处理
- 原生态openstack安装
- HDOJ 1202 The calculation of GPA
- Codeforces 884D:合并果子
- MySql-02.查询
- Dice Possibility hiho一下 第174周
- HDU 5919-Sequence II(主席树)
- MySQL时间相关函数总结
- django系列学习-前言
- JAVA架构师课程(大数据,分布式事物解决方案,大型互联网项目,大型金融项目,高并发集群解决方案)实战开发[技术 activeMQ,zookeeper,http,支付,团购,dubbox,stom]
- 社交网络分析算法(SNA)