http://acm.hdu.edu.cn/showproblem.php?pid=2061

Problem Description
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.
 
Input
The first number N indicate that there are N test cases(N <= 50). In each case, there is a number K (the total courses number), then K lines followed, each line would obey the format: Course-Name (Length <= 30) , Credits(<= 10), Score(<= 100).
Notice: There is no blank in the Course Name. All the Inputs are legal
 
Output
Output the GPA of each case as discribed above, if the GPA is not existed, ouput:"Sorry!", else just output the GPA value which is rounded to the 2 digits after the decimal point. There is a blank line between two test cases. 
 
Sample Input
2
3
Algorithm 3 97
DataStruct 3 90
softwareProject 4 85
2
Database 4 59
English 4 81
 
Sample Output
90.10
Sorry!
 
代码:

#include <bits/stdc++.h>
using namespace std; int main()
{
int T;
char name[50];
double num[1111],score[1111];
scanf("%d",&T);
for(int i=1; i<=T; i++)
{
if(i!=1)
printf("\n");
int x,flag=0;
scanf("%d",&x);
double sum=0,ans=0;
for(int j=1; j<=x; j++)
{
scanf("%s%lf%lf",name,&num[j],&score[j]);
if(score[j]<60)
flag=1;
sum+=num[j]*score[j];
ans+=num[j];
}
//cout<<sum<<" "<<ans<<" "<<flag<<endl;
if(flag==0)
printf("%.2lf\n",sum/ans);
else
printf("Sorry!\n");
}
return 0;
}

  

HDU 2061 Treasure the new start, freshmen!的更多相关文章

  1. HDOJ(HDU) 2061 Treasure the new start, freshmen!(水题、)

    Problem Description background: A new semester comes , and the HDU also meets its 50th birthday. No ...

  2. hdu2061 Treasure the new start, freshmen!(暴力简单题)

    Treasure the new start, freshmen! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/3276 ...

  3. HDU 3468 Treasure Hunting(BFS+网络流之最大流)

    题目地址:HDU 3468 这道题的关键在于能想到用网络流.然后还要想到用bfs来标记最短路中的点. 首先标记方法是,对每个集合点跑一次bfs,记录全部点到该点的最短距离.然后对于随意一对起始点来说, ...

  4. hdu 2061

    PS:  以为找个简单来恢复信心..结果碰到那么傻逼的题目... 题意:给出学分和成绩,算GPA...关键是注意换行....它要求的换行我觉得超级奇怪...除了第一个正常,其他的输入完之后先一个换行. ...

  5. HDU 3641 Treasure Hunting(阶乘素因子分解+二分)

    题目链接:pid=3641">传送门 题意: 求最小的 ( x! ) = 0 mod (a1^b1*a2^b2...an^bn) 分析: 首先吧a1~an进行素因子分解,然后统计下每一 ...

  6. hdu 3641 Treasure Hunting 强大的二分

    /** 大意:给定一组ai,bi . m = a1^b1 *a2^b2 * a3^ b3 * a4^b4*...*ai^bi 求最小的x!%m =0 思路: 将ai 质因子分解,若是x!%m=0 那么 ...

  7. 【网络流】 HDU 3468 Treasure Hunting

    题意: A-Z&&a-z 表示 集结点 从A点出发经过 最短步数 走到下一个集结点(A的下一个集结点为B ,Z的下一个集结点为a) 的路上遇到金子(*)则能够捡走(一个点仅仅能捡一次) ...

  8. HDU100题简要题解(2060~2069)

    这十题感觉是100题内相对较为麻烦的,有点搞我心态... HDU2060 Snooker 题目链接 Problem Description background: Philip likes to pl ...

  9. hdu2060-2062

    hdu 2060 斯诺克,读懂题意直接模拟 #include<stdio.h> int main(){ int N; ]; a[]=; ;i<=;i++){ a[i]=(-i)*i/ ...

随机推荐

  1. 20155236范晨歌_EXP3免杀原理与实践

    20155236范晨歌_免杀原理与实践 免杀 概述 免杀,也就是反病毒(AntiVirus)与反间谍(AntiSpyware)的对立面,英文为Anti-AntiVirus(简写Virus AV),逐字 ...

  2. 课下测试补交(ch01、ch02、ch07)

    课下测试补交(ch01.ch02.ch07) 课下测试ch01 1.Amdahl定律说明,我们对系统的某个部分做出重大改进,可以显著获得一个系统的加速比.(B) A . 正确 B . 错误 解析:课本 ...

  3. jzoj5377 开拓

    哇好火的dp啊. 开始根本想不出 这里如果顺着dp肯定是不行的,没办法记录钻头能力值 显然能力值的变化会影响后面收入 而具体影响就是:全部乘了1-0.01k或1+0.01c. 可以倒着dp(orz) ...

  4. Java虚拟机笔记(二):GC垃圾回收和对象的引用

    为什么要了解GC 我们都知道Java开发者在开发过程中是不需要关心对象的回收的,因为Java虚拟机的原因,它会自动回收那些失效的垃圾对象.那我们为什么还要去了解GC和内存分配呢? 答案很简单:当我们需 ...

  5. SSIS 数据流优化

    一,数据流设计优化 数据流有两个特性:流和在内存缓冲区中处理数据,根据数据流的这两个特性,对数据流进行优化. 1,流,同时对数据进行提取,转换和加载操作 流,就是在source提取数据时,转换组件处理 ...

  6. 英文样式教师求职简历免费word模板

    10款英文样式教师求职简历免费word模板,也可用于其他专业和职业,个人免费简历模板,个人简历表免费,个人简历表格. 声明:该简历模板仅用于个人欣赏使用,请勿用于商业用途,谢谢. 下载地址:百度网盘, ...

  7. python002

    1.万恶的”+“号字符串拼接 字符串中的连接符+”会开辟一个新的空间,多一个“+“就会多开辟一个空间,影响性能 2.字符串格式化 ”%S“   :字符类型         ”%D“   ”数字类型  ...

  8. requests.get()解析

    1.requests.get(url, params=None, headers=None, cookies=None, auth=None, timeout=None) Sends a GET re ...

  9. Docker创建容器

    容器是镜像的一个运行实例,是基于镜像运行的轻量级环境,是一个或者一组应用. 怎样创建容器?将容器所基于的镜像名称传入即可,Docker会从本地仓库中寻找该镜像,如果本地仓库没有,则会自动从远程仓库中拉 ...

  10. NO 18---- webpack 4.x 使用遇到的问题以及开发配置

    最近在项目中用webpack的过程中老是出现问题,很是纳闷,按理说一直这样使用没有问题啊,经过我研究后发现,是因为在webpack更新到4.x之后,操作方式与之前相比变化很大.而我们使用npm默认安装 ...