Treasure the new start, freshmen!

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 23047    Accepted Submission(s): 6814

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;
char s[];
int main()
{
int t;
while(~scanf("%d",&t))
{
while(t--)
{
int n;
scanf("%d",&n);int r=;
double sum1=,sum2=;
double cre,score;
for(int i=;i<n;i++)
{
memset(s,'\0',sizeof(s));
scanf("%s %lf %lf",s,&cre,&score);
if(score<)r=;
sum1=cre*score+sum1;
sum2=cre+sum2;
}
if(r)
{
printf("Sorry!\n");
}
else
{
printf("%.2lf\n",sum1/sum2);
}
if(t!=)printf("\n");
}
}
return ;
}

hdu2061 Treasure the new start, freshmen!(暴力简单题)的更多相关文章

  1. HDU 6463.超级无敌简单题-卡边界的暴力 (“字节跳动-文远知行杯”广东工业大学第十四届程序设计竞赛)

    超级无敌简单题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Sub ...

  2. [BZOJ2683][BZOJ4066]简单题

    [BZOJ2683][BZOJ4066]简单题 试题描述 你有一个N*N的棋盘,每个格子内有一个整数,初始时的时候全部为0,现在需要维护两种操作: 命令 参数限制 内容 1 x y A 1<=x ...

  3. 又一道简单题&&Ladygod(两道思维水题)

    Ladygod Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit S ...

  4. 【BZOJ4066】简单题 KDtree

    [BZOJ4066]简单题 Description 你有一个N*N的棋盘,每个格子内有一个整数,初始时的时候全部为0,现在需要维护两种操作: 命令 参数限制 内容 1 x y A 1<=x,y& ...

  5. [bzoj4066/2683]简单题_KD-Tree

    简单题 bzoj-4066 题目大意:n*n的棋盘,开始为均为0,支持:单点加权值,查询矩阵权值和,强制在线. 注释:$1\le n\le 5\cdot 10^5$,$1\le m \le 2\cdo ...

  6. bzoj3687简单题(dp+bitset优化)

    3687: 简单题 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 861  Solved: 399[Submit][Status][Discuss] ...

  7. 树状数组例题-数星星,简单题easy,校门外的树2,清点人数

    [例1]数星星 天空中有一些星星,这些星星都在不同的位置,每个星星都有个坐标,如果一个星星的左下方(包括正左和正下)有k颗星星,就说这颗星星是k级的. 比如,上图中,星星5是3级的(1,2,4在其左下 ...

  8. BZOJ 2683: 简单题

    2683: 简单题 Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 913  Solved: 379[Submit][Status][Discuss] ...

  9. 【BZOJ-1176&2683】Mokia&简单题 CDQ分治

    1176: [Balkan2007]Mokia Time Limit: 30 Sec  Memory Limit: 162 MBSubmit: 1854  Solved: 821[Submit][St ...

随机推荐

  1. html字段验证

    (1)连接去掉下划线:style="text-decoration:none" <a href="/example/html/lastpage.html" ...

  2. Mac安装软件时提示已损坏的解决方法

    问题描述 最近安装从网上下载的软件,安装完之后打开提示xxx已损坏,打不开,软件无法打开. 其实,这是新系统(macOS Sierra 10.12.X)新安全机制的锅,它默认不允许用户自行下载安装应用 ...

  3. jFinal 2.2入门学习之一:搭建框架输出helloword

    官方推荐用Eclipse IDE for Java EE Developers 做为开发环境 1.创建 Dynamic Web Project 2.修改 Default Output Folder,推 ...

  4. Angular动态表单生成(三)

    ng-dynamic-forms实践篇(上) 定个小目标 先来定个小目标吧,我们要实现的效果: 动态生成一个表单,里面的字段如下: 字段名称 字段类型 验证 备注 姓名 text 必填,长度小于15 ...

  5. npm run dev启动项目报错 Cannot find module 'webpack-cli/bin/config-yargs'

    一般是webpack的版本和webpackserver的版本不兼容导致的错误. 解决方法是先卸载这两个版本,再安装指定的版本. 卸载: 再安装指定或者最新版本的webpack和webpack-dev- ...

  6. 基于 HTML5 WebGL 的 3D 风机 Web 组态工业互联网应用

    基于 HTML5 WebGL 的 3D 风机 Web 组态工业互联网应用 前言 在目前大数据时代背景之下,数据可视化的需求也变得越来越庞大,在数据可视化的背景之下,通过智能机器间的链接并最终将人机链接 ...

  7. 遍历语法for...in for...of iterator

    1.Javascript最常见的遍历语法是for循环 缺点:写法较为麻烦 for (let index = 0; index < array.length; index++) { const e ...

  8. 开发Web版一对一远程直播教室只需30分钟 - 使用face2face网络教室

    转载自:https://blog.csdn.net/wo_shi_ma_nong/article/details/88110111 在“为网站开发远程直播教室的折腾过程及最终实现”中,介绍了如何使用f ...

  9. tp5 接入腾讯对象存储COS

    以前写过一个接入阿里的OSS对象存储的,现在又简单写了个 腾讯COS对象存储. 这里只有COS使用方式,如果对接TP上传 可以去参考 :http://www.cnblogs.com/inkwhite/ ...

  10. [示例] Firemonkey 面包屑导航

    原码下载:[示例]Firemonkey面包屑导航_Aone.zip 效果:(以下效果不用写一行代码)