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也非 ...
随机推荐
- sprintf_s的使用
int sprintf_s(char *restrict buffer, rsize_t bufsz, const char *restrict format, ...); ...
- Delphi线程同步(临界区、互斥、信号量)
当有多个线程的时候,经常需要去同步这些线程以访问同一个数据或资源. 例如,假设有一个程序,其中一个线程用于把文件读到内存,而另一个线程用于统计文件的字符数.当然,在整个文件调入内存之前,统计它的计数是 ...
- POJ2762 Going from u to v or from v to u(单连通 缩点)
判断图是否单连通,先用强连通分图处理,再拓扑排序,需注意: 符合要求的不一定是链拓扑排序列结果唯一,即在队列中的元素始终只有一个 #include<cstdio> #include< ...
- git push 使用总结
git push命令用于将本地分支的更新,推送到远程主机.它的格式与git pull命令相仿. $ git push <远程主机名> <本地分支名>:<远程分支名> ...
- C# SMTP邮件发送 分类: C# 2014-07-13 19:10 334人阅读 评论(1) 收藏
邮件发送在网站应用程序中经常会用到,包括您现在看到的博客,在添加评论后,系统会自动发送邮件通知到我邮箱的,把系统发送邮件的功能整理了下,做了一个客户端Demo,希望对有需要的童鞋有所帮助: 核心代码: ...
- IIS7报错
错误内容:”未能加载文件或程序集“IWMS_Admin”或它的某一个依赖项.试图加载格式不正确的程“ 解决方法:进入IIS“应用程序池”,然后在右边列表中,选中当前网站所使用的程序池,打开右侧的“高级 ...
- 解决因为I_JOB_NEXT问题导致job执行不正常,不停生成trace文件问题
今天同事说有个项目生产环境的目录老是满.查看了一下bdump目录,发现确实是平均1分钟生成一个8M左右的trace文件.查询了一下alert日志,发现是个job的报错引起的.具体查看了一下trace文 ...
- Intent传递类实例
发送方: Intent intent = new Intent(); intent.setClass(mContext, HomeDetailReportActivity.class); intent ...
- python客户端编程
上一篇说了最为底层的用来网络通讯的套接字.有很多基于套接字的一些协议,这些协议构成了当今互联网大多数客户服务器应用的核心 其实这些协议时在套接字上面的进一层封装用来完成特定的应用,这些应用主要包括: ...
- AndroidStudio导入新项目一直卡在Building gradle project info的解决解决方案
尝试了各种办法,FQ,离线gradle等,发现一个更好用更简单的办法: 解决方案: 1.随便找一个你能运行的as项目 2.打开gradle-wrapper.properties,文件目录:项目/g ...