ACM: 限时训练题解-Epic Professor-水题
Epic Professor
Dr. Bahosain works as a professor of Computer Science at HU (Hadramout University).
After grading his programming exam, he noticed that most of the students have failed. Since this is the last semester for him teaching in Yemen, Dr. Bahosain decided to give bonus marks to all students in a fair way. He decided to give the same bonus marks to all students without making the mark of any student exceed 100.
Help Dr. Bahosain by finding the maximum possible number of students that will pass the course after adding the bonus marks.
A student will pass the course if his mark after adding the bonus marks is more than or equal to 50. Input
The first line of input contains an integer T (1 ≤ T ≤ 1024) that represents the number of test cases.
The first line of each test case contains one integer N (1 ≤ N ≤ 100) that represents the number of students in Dr. Bahosain’s class.
The next line contains N space-separated integers between 0 and 100, each representing the initial mark of a student.
Output
For each test case, print a single line with the maximum number of students that will pass the course.
|
Sample Input |
Sample Output |
|
2 |
3 |
|
5 |
4 |
|
0 21 83 45 64 |
|
|
7 |
|
|
99 50 46 47 48 49 98 |
/*
题意教授打分,给每个同学加相同的分数,不能有超过100分的,学生达到50分就合格。
问有最多有多少合格的学生。 AC代码:
*/ #include"iostream"
#include"algorithm"
#include"cstdio"
#include"cstring"
#include"cmath"
#define MX 100 + 5
using namespace std; int a[MX]; bool cmp( int a,int b) {
return a>b;
} int main() {
int T,n,maxx,ans;
scanf("%d",&T);
while(T--) {
maxx=0,ans=0;
scanf("%d",&n);
for(int i=0; i<n; i++) {
scanf("%d",&a[i]);
maxx=max(maxx,a[i]);
}
sort(a,a+n);
int add=100-maxx;
for(int i=0; i<n; i++) {
if(a[i]+add>=50)ans++;
}
printf("%d\n",ans);
}
return 0;
}
ACM: 限时训练题解-Epic Professor-水题的更多相关文章
- ACM: 限时训练题解-Street Lamps-贪心-字符串【超水】
Street Lamps Bahosain is walking in a street of N blocks. Each block is either empty or has one la ...
- ACM: 限时训练题解-Rock-Paper-Scissors-前缀和
Rock-Paper-Scissors Rock-Paper-Scissors is a two-player game, where each player chooses one of Roc ...
- ACM: 限时训练题解- Travelling Salesman-最小生成树
Travelling Salesman After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends mos ...
- ACM: 限时训练题解-Runtime Error-二分查找
Runtime Error Bahosain was trying to solve this simple problem, but he got a Runtime Error on one ...
- ACM: 限时训练题解-Heavy Coins-枚举子集-暴力枚举
Heavy Coins Bahosain has a lot of coins in his pocket. These coins are really heavy, so he always ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- HDU ACM 1073 Online Judge ->字符串水题
分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...
- ACM: POJ 1401 Factorial-数论专题-水题
POJ 1401 Factorial Time Limit:1500MS Memory Limit:65536KB 64bit IO Format:%lld & %llu ...
- 蓝桥杯 入门训练 Fibonacci数列(水题,斐波那契数列)
入门训练 Fibonacci数列 时间限制:1.0s 内存限制:256.0MB 问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1. 当n比较大时,Fn也非 ...
随机推荐
- My97DatePicker使用技巧
My97DatePicker使用是很常用的控件,总结一下常用使用技巧: 1.onpicked是事件,也就选择日期之后触发事件: 2.isShowClear:是否显示清理按钮: 3.maxDate:最大 ...
- [LeetCode] Rotate Image
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...
- PHP利用jquery生成各种验证码和Ajax验证
PHP生成验证码图片 PHP生成验证码的原理:使用PHP的GD库,生成一张带验证码的图片,并将验证码保存在Session中.PHP 生成验证码的大致流程有: .产生一张png的图片: .为图片设置背景 ...
- WebBrowser控件打开https站点
背景: 与上一篇博文一样,此文亦是由于开发DropboxAPI中遇到问题衍生出来的.由于需要重定向https类型网站,但自己的https证书是自签名的,总是提示'网站的安全证书存在问题'. 鉴此,查了 ...
- 一些常用的C++标准函数
一些常用的C++标准函数 double atof(const char* p); int atoi(const char* p); long atol(const char* p); cstdlib ...
- 【转】GeoHash核心原理解析
好久没更新过博客了,先转载一篇文章吧. 源地址:http://www.cnblogs.com/LBSer/p/3310455.html 引子 机机是个好动又好学的孩子,平日里就喜欢拿着手机地图点点按按 ...
- hdu 5833 Zhu and 772002 高斯消元
Zhu and 772002 Problem Description Zhu and 772002 are both good at math. One day, Zhu wants to test ...
- 通讯录(ios自带无界面)
1,添加框架AddressBook.framework 2,请求权限认证,在Appdelegate.m文件中 - (BOOL)application:(UIApplication *)applicat ...
- 对于JSP的调试
在eclipse中调试JSP 我换了图片但是网页中的图片却不变化 我删了工程里的图片还是没用 看了一下Tomcat根目录..貌似也是没有的.. 最后我考虑换了HTML中图片的名字..并且更改了替换的图 ...
- codeforces733D. Kostya the Sculptor 偏序cmp排序,数据结构hash,代码简化
对于n==100.1,1,2或者1,2,2大量重复的形状相同的数据,cmp函数最后一项如果表达式带等于,整个程序就会崩溃 还没有仔细分析std::sort的调用过程,所以这里不是很懂..,mark以后 ...