您的位置:首页 > Web前端

Gym 100712E Epic Professor

2016-05-15 21:28 323 查看
题目链接:http://codeforces.com/gym/100712/attachments

大水题,排序找出最大的成绩,然后用100减去它,再将每个人的成绩加上这个差,判断即可。

附上AC代码:

#include <bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000, 102400000")
using namespace std;
const int maxn = 105;
int score[maxn];
int n;

int main(){
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int T;
scanf("%d", &T);
while (T--){
scanf("%d", &n);
for (int i=0; i<n; ++i)
scanf("%d", score+i);
sort(score, score+n);
int t=100-score[n-1], ans=0;
for (int i=0; i<n; ++i)
if (score[i]+t >= 50)
++ans;
printf("%d\n", ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  gym 排序