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. .net学习笔记---xml操作及读写

    一.XML文件操作中与.Net中对应的类 微软的.NET框架在System.xml命名空间提供了一系列的类用于Dom的实现. 以下给出XML文档的组成部分对应.NET中的类: XML文档组成部分 对应 ...

  2. Android屏幕旋转总结

    转自:http://www.myexception.cn/operating-system/1452058.html 1. ProjectConifg.mk中定义宏MTK_LCM_PHYSICAL_R ...

  3. 【PHP自定义显示系统级别的致命错误和用户级别的错误】

    使用方法set_error_handler可以自定义用户级别的错误和系统级别的错误信息显示和处理 用户级别的错误使用trigger_error方法产生一个用户级别的错误信息 代码示例: 系统级别的错误 ...

  4. 【openGL】画直线

    #include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math ...

  5. T-SQL 常用语句

    1. 查看 Table 或者 Column 被那些object(存储过程.函数或View)调用. select a.* from sysobjects a, syscomments b where a ...

  6. 在Activity和Application中使用SharedPreferences存储数据

    1.在Activity中创建SharedPreferences对象及操作方法 SharedPreferences pre=getSharedPreferences("User", ...

  7. OpenMesh 删除网格顶点

    OpenMesh 提供了 delete_vertex() 函数来实现从网格中删除顶点,在删除掉顶点的同时,所有与该顶点相连的边也同时被删除. OpenMesh 官方文档 中给的顶点删除函数声明如下: ...

  8. PAT A 1016. Phone Bills (25)【模拟】

    题目:https://www.patest.cn/contests/pat-a-practise/1016 思路:用结构体存储,按照名字和日期排序,然后先判断是否有效,然后输出,时间加减直接暴力即可 ...

  9. Intent传递类实例

    发送方: Intent intent = new Intent(); intent.setClass(mContext, HomeDetailReportActivity.class); intent ...

  10. IIS 内部运行机制

    ASP.NET是一个非常强大的构建Web应用的平台,它提供了极大的灵活性和能力以致于可以用它来构建所有类型的Web应用. 绝大多数的人只熟悉高层的框架如: WebForms 和 WebServices ...