hdoj 1202 the calculation of GPA(水题)
来源:互联网 发布:视频转换格式软件 编辑:程序博客网 时间:2024/06/01 22:40
思路:直接给代码了
代码如下:
#include <iostream> #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <algorithm>#include <vector>using namespace std;int main(){int n;double s,p;double sum1,sum2;while(scanf("%d",&n)!=EOF){sum1=sum2=0.0;while(n--){scanf("%lf%lf",&s,&p);if((int)p+1==0)continue;sum1+=s;if(p>=90)sum2+=4*s;else if(p>=80)sum2+=3*s;else if(p>=70)sum2+=2*s;else if(p>=60)sum2+=s; }if(sum1!=0)printf("%.2lf\n",sum2/sum1);else printf("-1\n");} return 0; }
阅读全文
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
- 杭电--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
- Problem : 1202 ( The calculation of GPA )
- HDU 1202 The calculation of GPA
- HDU 1202 The calculation of GPA
- network chess
- JavaScript基础教程171220
- 五二、js字符串截取函数slice()、substring()、substr()
- hibernate用注解 一对多 报Could not determine type for错误
- spring mvc 转发
- hdoj 1202 the calculation of GPA(水题)
- 北京云栖大会 Tech Insight 金融级分布式架构分享一览
- 常见的MAC算法(PBOC_3DES_MAC、ANSI X9.9MAC算法、ANSI x9.19算法)
- 计算总价
- github项目学习指南
- win10安装Centos7
- Linux下忘记root密码重置过程笔记
- java基础---(2)Java中token的使用详解
- 购物车