hdu 2061
PS: 以为找个简单来恢复信心..结果碰到那么傻逼的题目...
题意:给出学分和成绩,算GPA...关键是注意换行....它要求的换行我觉得超级奇怪...除了第一个正常,其他的输入完之后先一个换行..//为什么要这样换行..?反正我是看了AC代码才知道要这样换行...
贴上自己的代码...
代码:
#include "stdio.h"
int main(){
double c[],s[],flag1,sum,sum1;
int T,i,j,n,flag,space=;
scanf("%d%*c",&T);
while(T--){
scanf("%d",&n);
sum=0.0;
sum1=0.0;
flag=;
for(i=;i<n;i++){
scanf("%*s%lf%lf%*c",&c[i],&s[i]);
if(s[i]< && s[i]>=) flag=;
sum+=(c[i]*s[i]);
sum1+=c[i];
}
if (space ++ != ) printf ("\n") ;
if(flag == || sum1 == ){
printf("Sorry!\n");
continue;
}
flag1=sum/sum1;
printf("%.2lf\n",flag1);
}
return ;
}
hdu 2061的更多相关文章
- HDU 2061 Treasure the new start, freshmen!
http://acm.hdu.edu.cn/showproblem.php?pid=2061 Problem Description background:A new semester comes , ...
- HDOJ(HDU) 2061 Treasure the new start, freshmen!(水题、)
Problem Description background: A new semester comes , and the HDU also meets its 50th birthday. No ...
- hdu2060-2062
hdu 2060 斯诺克,读懂题意直接模拟 #include<stdio.h> int main(){ int N; ]; a[]=; ;i<=;i++){ a[i]=(-i)*i/ ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- (并查集)Travel -- hdu -- 5441(2015 ACM/ICPC Asia Regional Changchun Online )
http://acm.hdu.edu.cn/showproblem.php?pid=5441 Travel Time Limit: 1500/1000 MS (Java/Others) Memo ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
随机推荐
- 能源项目xml文件 -- app-context.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- The Economist
The turning point in the process of growing up is when you discover the core of strength within yo ...
- canvas drawImage异步特性
先看代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- css3实现超过两行文字,超出用三个点显示(兼容性不行,仅供学习)
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> ...
- js获取随机数
js 获取随机数方法如下: 1.Math.random()表示 结果为0-1间的一个随机数(包括0,不包括1) : 返回指定范围的随机数(m-n之间)的公式 Math.random()*(n-m)+m ...
- hdu 4405Aeroplane chess(概率DP)
Aeroplane chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- Multiply Strings [LeetCode]
Problem Description http://oj.leetcode.com/problems/multiply-strings/ Basic idea is to multiply two ...
- input覆盖select实现select可写可选择
1.有时需要一个select选择框,但是对select选择框希望是既可以选择也可以进行输入.下边的代码就是在select选择框上放了一个input框,覆盖在select上面.实现伪装的select效果 ...
- Apache网页有时能访问,有时超时打不开
在win server 2008上安装wamp2.4版本,配置apache 访问网页一直在加载,似乎被挂起. 转圈需要3分钟多钟, 最终显示无法访问. 或者超时. 错误日志中有如下提示: [Sat J ...
- Understanding Virtual Memory
Understanding Virtual Memory by Norm Murray and Neil Horman Introduction Definitions The Life of a P ...