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;
}
大水题,排序找出最大的成绩,然后用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;
}
相关文章推荐
- 在命令行用 sort 进行排序
- 文件遍历排序函数
- C#选择排序法实例分析
- C#插入法排序算法实例分析
- C#实现Datatable排序的方法
- MYSQL必知必会读书笔记第五章之排序检索数据
- SQLSERVER的排序问题结果不是想要的
- Windows Powershell排序和分组管道结果
- C#通过IComparable实现ListT.sort()排序
- C#选择法排序实例分析
- SQL学习笔记四 聚合函数、排序方法
- C#对list列表进行随机排序的方法
- jQuery拖动元素并对元素进行重新排序
- 将MySQL查询结果按值排序的简要教程
- 一根网线内的8根线哪4根是传输数据的,哪四根是防干扰的
- 在ASP.NET 2.0中操作数据之二十四:分页和排序报表数据
- C语言实现选择排序、冒泡排序和快速排序的代码示例
- C#折半插入排序算法实现方法
- SQL进行排序、分组、统计的10个新技巧分享
- 简单了解C语言中直接插入排序与直接选择排序实现