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. 中文字体@font-face的导入

    由于英文字母只有26个,所以生成.eot..woff..ttf..svg等文件是比较小的,也就十几KB而已.但是对于汉字来说,常用的汉字就已经2500个了,生成的文件一般要2-3MB,如此庞大的包对页 ...

  2. Android签名生成和互转

    原文链接:http://blog.votzone.com/2018/05/05/android_signature.html   Android 的签名有两种方式,一种使用jdk 提供的jarsign ...

  3. ios - 沙盒和NSBundle

    沙盒 1.沙盒机制介绍 iOS中的沙盒机制是一种安全体系.每个iOS程序都有一个独立的文件系统(存储空间),而且只能在对应的文件系统中进行操作,此区域被称为沙盒.应用必须待在自己的沙盒里,其他应用不能 ...

  4. 2019年,200道面试题打造最受企业欢迎的iOS程序猿!

    在2018年底,小编混迹在各种iOS交流群中,整理出了将近两百道大厂最喜欢在面试问到的问题,今天在这里分享给大家[免费获取方式在最后]!                           小编就不在 ...

  5. 深入理解java虚拟机读后总结

    之前看过,很多会遗忘,标记一下,温故知新.(明天的我一定会感谢现在努力的自己. ) 一.运行时数据区域 Java虚拟机管理的内存包括几个运行时数据内存:方法区.虚拟机栈.本地方法栈.堆.程序计数器,其 ...

  6. SQLServer禁用、启用外键约束

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ---启用or禁用指定表所有外键约束  alter table PUB_STRU  NOCHECK constrai ...

  7. C++学习---指针相关

    1.指向 “指针对象” 的 ”指针” 一般指针 int *p1,ival =42; p1 = &ival; 或者 int ival =42,*p1=&val; 代表一个指针对象指向一个 ...

  8. 前端基础-jQuery的最常用的的方法each、data、

    阅读目录 each inArray get index data 一.jQuery中each方法的应用 jQuery中有个很重要的核心方法each,大部分jQuery方法在内部都会调用each,其主要 ...

  9. sql 事务处理 与 try catch

    begin transaction tr declare @error int; ; select * from Car_Brand set @error=@error+@@ERROR set @er ...

  10. PHP 判断密码强度

                 $score = 0;            if(preg_match("/[0-9]+/",$str))            {           ...