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. WEB测试—兼容测试

    现在的操作系统,浏览器越来越多样性,导致软件兼容性测试在目前软件测试领域占有很重要的地位,我在测试项目经历中,以浏览器的兼容测试为主,平台.分辨率为辅. (我的经验前提:我测试过3类的不同行业的web ...

  2. HDU 2307 贪心之活动安排问题

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2037 今年暑假不AC Time Limit: 2000/1000 MS (Java/Others)  ...

  3. SQL修改字段默认值、获取字段默认值

    一.SQL修改字段默认值 alter table 表名 drop constraint 约束名字 说明:删除表的字段的原有约束 alter table 表名 add constraint 约束名字 D ...

  4. mysql查询某个数据库表的数量

    在mysql中有个数据库information_schema下的表tables记录了所有数据库中所有的表相关信息 TABLE_SCHEMA 数据库名称 SELECT COUNT( * ) FROM i ...

  5. Linux-- su和sudo 切换用户

    su 切换用户 用法:su [选项] [-] [用户 [参数]... ] - :以 login-shell 方式进行登录 不加 - :以 no-login-shell 方式进行登录 -c:只进行一次在 ...

  6. Java并发编程(八)线程间协作(上)

    多线程并发执行时,不同的线程执行的内容之间可能存在一些依赖关系,比如线程一执行a()方法和c()方法,线程二执行b()方法,方法a()必须在方法b()之前执行,而方法c()必须在方法b()之后执行.这 ...

  7. Python中级 —— 04网络编程

    网络编程 网络编程对所有开发语言都是一样的,Python也不例外.用Python进行网络编程,就是在Python程序本身这个进程内,连接别的服务器进程的通信端口进行通信. TCP编程 TCP建立可靠连 ...

  8. Vue基础学习(纯属个人学习的笔记,慢慢新增)

       1.在html文件中,声明了template对象,那么在 data对象中的v-html和v-text的绑定数据是不起作用的 2.v-的几个常用绑定 v-html和v-text:引用的conten ...

  9. 触摸屏之linux3.4.2安装tslib

    1. 写好触摸屏驱动后,安装tslib 1.1 tar xzf tslib-1.4.tar.gz 1.2 cd tslib 1.3 修改编译器版本号或者内核版本号,使它们一致.不然会出错,显示sele ...

  10. Spring 注解学习

    @GetMapping(value = "/hello/{id}")//需要获取Url=localhost:8080/hello/id中的id值 public String say ...