noip2016 1.排名
来源:互联网 发布:德力西 知乎 编辑:程序博客网 时间:2024/04/27 04:28
#include<cstdio>//2016noip练习题,1;
#include<iostream>
using namespace std;
int x,sum,n,m,ans,maxx;
int main()
{
freopen("rank.in","r",stdin);
freopen("rank.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
sum+=(x-1);
maxx+=(m-x);//超过的人员总数;
}
sum+=1;
if(sum>=m)sum=m;
if(maxx>=m)ans=1;//若超过的人大于总人数,则最好名次可到的一名;
else ans=m-maxx;
printf("%d\n%d",ans,sum);
return 0;
}
#include<iostream>
using namespace std;
int x,sum,n,m,ans,maxx;
int main()
{
freopen("rank.in","r",stdin);
freopen("rank.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
sum+=(x-1);
maxx+=(m-x);//超过的人员总数;
}
sum+=1;
if(sum>=m)sum=m;
if(maxx>=m)ans=1;//若超过的人大于总人数,则最好名次可到的一名;
else ans=m-maxx;
printf("%d\n%d",ans,sum);
return 0;
}
0 0
- noip2016 1.排名
- NOIP2016排名(1~745)
- NOIP2016排名(919~1419)
- NOIP2016普及组复赛广东省一等奖名单及排名
- NOIP2016
- NOIP2016
- NOIP2016
- noip2016
- noip2016
- NOIP2016
- noip2016
- noip2016
- NOIP2016普及组复赛全国一等奖名单及排名(1~745名)
- NOIP2016普及组复赛全国一等奖名单及排名(续表_919~1419名)
- 排名
- 排名
- 排名
- 排名
- 获得文件的创建时间(精确到时分秒)
- 网络请求Retrofit工具类 底层用okhttp
- strip---机器学习实战与Python
- 空白字符编码
- synchronized与static synchronized的区别
- noip2016 1.排名
- HDU 2191 悼念512汶川大地震遇难同胞――珍惜现在,感恩生活 (背包问题)
- LeetCode: Search for a Range 解题报告
- hihocoder 136 #1269 优化延迟 二分+优先队列
- cocos2dx-lua 对lua项目中class(sub,super)的理解
- 《C++ Primer》读书笔记-第一章 Hello World
- getSystemService与getService区别
- 【C++】浅析C++中的对象模型
- struts2 无法获取action属性的问题解决