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. [LeetCode] Isomorphic Strings

    Isomorphic Strings Total Accepted: 30898 Total Submissions: 120944 Difficulty: Easy Given two string ...

  2. Uncaught ReferenceError: console is not defined

    今天写javascript代码遇到了这个极其神奇的问题,居然报错说内置的console不存在,而且后来我换成了alert也不行.照例说这些都是js代码内置的东西不应该出现这种错误.不过百度之发现貌似没 ...

  3. linux驱动程序设计的硬件基础,王明学learn

    linux驱动程序设计的硬件基础(一) 本章讲总结学习linux设备程序设计的硬件基础. 一.处理器 1.1通用处理器 通用处理器(GPP)并不针对特定的应用领域进行体系结构和指令集的优化,它们具有一 ...

  4. 如何在Ubuntu中让mongo远程可连接

    最近团队的一个成员由于项目原因需要在vps上建立mongo数据库服务器并允许远端访问,这里整理下设置的思路 首先需要安装mongo apt-get updateapt-get install mong ...

  5. AndroidStudio里面怎么取消与SVN的关联

    在公司做项目 遇到SVN解除关联的问题 后经过解决: 1.解除文件的关联方法: 1.1. 创建一个reg文件 如下 1.2 在文件中填入如下内容并保存: Windows Registry Editor ...

  6. UNIX索引技术访问文件初阶

    背景: 软考里面,多次碰到一道题: 过程 以前对于这样的题,仅仅知道: 在文件系统中,文件的存储设备通常划分为若干个大小相等的物理块,每块长为512或1024字节.文件的理结构是指文件在存储设备上的存 ...

  7. em与rem

    em是相对于父元素的font-size,rem是相对于根元素的font-size. rem的补充: ① 对于不支持它的浏览器,应对方法也很简单,就是多写一个绝对单位的声明.这些浏览器会忽略用rem设定 ...

  8. Android中ViewPager+Fragment取消(禁止)预加载延迟加载(懒加载)问题解决方案

    转载请注明出处:http://blog.csdn.net/linglongxin24/article/details/53205878本文出自[DylanAndroid的博客] Android中Vie ...

  9. TortoiseSVN菜单项功能说明

    TortoiseSVN是windows下其中一个非常优秀的SVN客户端工具.通过使用它,我们可以可视化的管理我们的版本库.不过由于它只是一个客户端,所以它不能对版本库进行权限管理. TortoiseS ...

  10. 如何通过java代码对kylin进行cube build

    通常是用于增量 代码如下: package com.dlht.kylinDemo; import java.io.BufferedReader; import java.io.FileNotFound ...