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-水题的更多相关文章

  1. ACM: 限时训练题解-Street Lamps-贪心-字符串【超水】

    Street Lamps   Bahosain is walking in a street of N blocks. Each block is either empty or has one la ...

  2. ACM: 限时训练题解-Rock-Paper-Scissors-前缀和

    Rock-Paper-Scissors   Rock-Paper-Scissors is a two-player game, where each player chooses one of Roc ...

  3. ACM: 限时训练题解- Travelling Salesman-最小生成树

    Travelling Salesman   After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends mos ...

  4. ACM: 限时训练题解-Runtime Error-二分查找

    Runtime Error   Bahosain was trying to solve this simple problem, but he got a Runtime Error on one ...

  5. ACM: 限时训练题解-Heavy Coins-枚举子集-暴力枚举

    Heavy Coins   Bahosain has a lot of coins in his pocket. These coins are really heavy, so he always ...

  6. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  7. HDU ACM 1073 Online Judge -&gt;字符串水题

    分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...

  8. ACM: POJ 1401 Factorial-数论专题-水题

    POJ 1401 Factorial Time Limit:1500MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu   ...

  9. 蓝桥杯 入门训练 Fibonacci数列(水题,斐波那契数列)

    入门训练 Fibonacci数列 时间限制:1.0s   内存限制:256.0MB 问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1. 当n比较大时,Fn也非 ...

随机推荐

  1. ps -C nginx --no-header |wc -l

    [root@ok ok]# ps --help|grep C -A all processes -C by command name -V,V show version L list format c ...

  2. 常用的Java代码汇总

    1. 字符串有整型的相互转换           Java   1 2 <strong>Stringa=String.valueOf(2);   //integer to numeric ...

  3. 湘潭1247 Pair-Pair(树状数组)

    分析: 给定n个二元组,求选出两个二元组(可以是同一个)组成一序列其LIS为1,2,3,4的方法数. 分别记为s1, s2, s3, s4 s1,s4对应的情形为a >= b >= c & ...

  4. iOS static

    获得20条news 先实现,再提取到business 层. The static Keyword You can have a local variable retain its value thro ...

  5. C# XML操作

    一.简单介绍 using System.Xml; //初始化一个xml实例 XmlDocument xml=new XmlDocument(); //导入指定xml文件 xml.Load(path); ...

  6. zoj 3882 博弈 *

    看了半天约数居然包括1,水了 #include<cstdio> #include<iostream> #include<algorithm> #include< ...

  7. ASP.NET 5探险(3):使用UMEditor并实现图片上传

    (此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:今天将继续上一篇来讲解百度富文本Web编辑器UEditor或UMEditor的使用. ...

  8. 第三篇:用SOUI能做什么?

    SOUI-DEMO界面预览 在回答SOUI能做什么之前,先看看SVN中demo工程的界面截图: 使用SOUI实现上面的界面主要的工作全在配置几个XML文件,基本不需要写C++代码.(如何配置XML布局 ...

  9. C语言中如何将二维数组作为函数的参数传递

    今天写程序的时候要用到二维数组作参数传给一个函数,我发现将二维数组作参数进行传递还不是想象得那么简单里,但是最后我也解决了遇到的问题,所以这篇文章主要介绍如何处理二维数组当作参数传递的情况,希望大家不 ...

  10. 接着上一篇 《Is WPF dead》

    最近美国的PM传来消息,说微软在收集开发者的意见,会对WPF进行改进,微软会主要在1) performance 2) interop 3) touch and 4) access to WinRT A ...