http://2050.acmclub.cn/contests/contest_show.php?cid=3

开场白

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Problem Description
来自世界各地的年青人在 https://2050.org.cn 握手团聚, 他们是航空航天的新生代,编程大赛的优胜者,35岁以下的创新者,科技公司的创始人,展望未来的科学家,天马行空的艺术家...... TA们期待在这里与所有人分享交流,给彼此灵感,给未来答案。
我们想要用10个题目,大声喊出年青人的声音。我们希望和大家一起用技术创造一个更好的2050。
第一道题目,我们来玩一个数字游戏。
给出一个数字 n

,我们想知道 n

是不是若干个 2050 依次拼接起来的。

 
Input
第一行一个正整数 T (T≤10)

表示数据组数。
对于每组数据,一行一个正整数 n (1≤n≤10^100000)

 
Output
对于每组数据,Yes 表示 n

是若干个 2050 依次拼接起来的,No 表示不是。

 
Sample Input
2
2050
205020
 
Sample Output
Yes
No
 
Source
Test Contest
题意:判断字符串是否是由若干个2050依次拼接形成的
题解:判断长度%4==0并且依次是2 0 5 0即可
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<vector>
  6. #include<queue>
  7. #include<cmath>
  8. #include<map>
  9. #include<set>
  10. using namespace std;
  11. typedef long long ll;
  12. char ch[];
  13. int main(){
  14. int t;
  15. scanf("%d",&t);
  16. char d[]="";
  17. while(t--){
  18. scanf("%s",ch);
  19. int f=;
  20. int len=strlen(ch);
  21. if(len%)f=;
  22. for(int i=;i<len;i++){
  23. if(ch[i]!=d[i%]){
  24. f=;
  25. }
  26. }
  27. if(f)printf("Yes\n");
  28. else printf("No\n");
  29. }
  30. return ;
  31. }

时间间隔

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7501    Accepted Submission(s): 2735

Problem Description
2019年1月1日,在云栖出现了可能是全世界最长的以秒为单位的倒计时装置:九亿多秒倒计时,直到2050年。
给出一个时间S,我们想知道S距离2050年1月1日0点0时0分多少秒。
因为答案可能很大,请输出答案模100的值。
 
Input
第一行一个正整数 T (1≤T≤100000)

表示数据组数。
对于每组数据,一行一个字符串表示时间。
时间格式为:YYYY-MM-DD HH:MM:SS,分别表示年、月、日、时,分、秒。
输入的时间保证都在2019年1月1日以后(包含当天)。

 
Output
对于每组数据输出一行一个整数表示答案。
 
Sample Input
1
2019-01-01 00:00:00
 
Sample Output
0
 
Source
Test Contest
题意:判断给出的一个日期距离2050.1.1.0.0的秒数%100的值.
题解:由于是%100的值,1h=3600s,所以h,day,month,year对结果的贡献都是0,所以只计算分秒就行了(我没看到取模..写完模拟才发现取模..下面是我的模拟代码)
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<vector>
  6. #include<queue>
  7. #include<cmath>
  8. #include<map>
  9. #include<set>
  10. using namespace std;
  11. typedef long long ll;
  12. int month[][]={
  13. {,,,,,,,,,,,,},
  14. {,,,,,,,,,,,,}
  15. };
  16. char ch[],ch2[];
  17. int main(){
  18. int t;
  19. scanf("%d",&t);
  20. while(t--){
  21. ll ans=;
  22. //2019-01-01 00:00:00
  23. scanf("%s%s",ch,ch2);
  24. int len=strlen(ch);
  25. int ye=,mon=,day=;
  26. for(int i=;i<;i++){
  27. ye*=;
  28. ye+=ch[i]-'';
  29. }
  30. for(int i=;i<;i++){
  31. mon*=;
  32. mon+=ch[i]-'';
  33. }
  34. for(int i=;i<;i++){
  35. day*=;
  36. day+=ch[i]-'';
  37. }
  38. int len2=strlen(ch2);
  39. int sum=;
  40. for(int i=;i<;i++){
  41. sum*=;
  42. sum+=ch2[i]-'';
  43. }
  44. sum*=;
  45. int sum2=;
  46. for(int i=;i<;i++){
  47. sum2*=;
  48. sum2+=ch2[i]-'';
  49. }
  50. sum2*=;
  51. int sum3=;
  52. for(int i=;i<;i++){
  53. sum3*=;
  54. sum3+=ch2[i]-'';
  55. }
  56. sum3+=sum2+sum;
  57. ans+=*-sum3;
  58. day++;
  59. if((ye%==&&ye%)||(ye%==)){
  60. if(day>month[][mon]){
  61. mon++;
  62. day=;
  63. }
  64. if(mon==){
  65. mon=;
  66. ye++;
  67. }
  68. ll days=month[][mon]-day+;
  69. for(int i=mon+;i<=;i++){
  70. days+=month[][i];
  71. }
  72. days*=*;
  73. ans+=days;
  74. ans%=;
  75. for(int i=ye+;i<;i++){
  76. if((i%==&&i%)||i%==){
  77. ans+=**;
  78. }
  79. else{
  80. ans+=**;
  81. }
  82. ans%=;
  83. }
  84. }
  85. else{
  86. if(day>month[][mon]){
  87. mon++;
  88. day=;
  89. }
  90. if(mon==){
  91. mon=;
  92. ye++;
  93. }
  94. ll days=month[][mon]-day+;
  95. for(int i=mon+;i<=;i++){
  96. days+=month[][i];
  97. }
  98. days*=*;
  99. ans+=days;
  100. ans%=;
  101. for(int i=ye+;i<;i++){
  102. if((i%==&&i%)||i%==){
  103. ans+=**;
  104. }
  105. else{
  106. ans+=**;
  107. }
  108. ans%=;
  109. }
  110. }
  111. printf("%lld\n",ans%);
  112. }
  113. return ;
  114. }

分宿舍

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Problem Description
“那天TA说TA要来,于是我就来啦。
那天我说我要来,于是你就来啦。
TA看到了什么?
你又看到了什么?
我看到你们在一起,我是真的很happy:)
太阳在哪里啊?
就在早上七八点。
太阳在哪里啊?
就在云的栖息地!”
——2050主题曲

2050的线下活动吸引了很多心怀梦想的年轻人。

小伙们打算组团去参加。他们一共有 n+m+2k

个人,包括 n+k

个男生,m+k

个女生,其中 k

对男女生为异性情侣,现在他们要找房间住。房间有三种类型,双人间 a

元一间,三人间 b

元一间,这两种只能同性一起住。情侣间能住一对异性情侣,一间 c

元。除了情侣间以外,其他房间都可以不住满。
求最少花多少钱,能让小伙伴们都有地方住。

 
Input
第一行一个整数 T (1≤T≤50)

表示数据组数。
接下来 T

组数据,每组数据一行 6

个整数 n,m,k,a,b,c

,其中 0≤n,m,k≤103,0≤a,b,c≤109

 
Output
对于每组数据输出一行一个数,表示所有人住下来所需要的最小花费。
 
Sample Input
2
3 0 1 1 3 3
3 3 2 1 6 2
 
Sample Output
3
6
 
Source
Test Contest
题意:有几种使用方式及价格不一样的房间,n+k个男生,m+k个女生,其中k对情侣,求最小花费.
题解:dp裸题(没学过dp的同学先跳过,以下是口胡时间),先对普通的房间进行普通的背包dp,更新后的结果再用情侣房间进行普通的背包dp即可
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<vector>
  6. #include<queue>
  7. #include<cmath>
  8. #include<map>
  9. #include<set>
  10. using namespace std;
  11. typedef long long ll;
  12. const ll inf=1e15;
  13. ll dp[];
  14. int main(){
  15. int t;
  16. scanf("%d",&t);
  17. while(t--){
  18. ll n,m,k,a,b,c;
  19. scanf("%lld%lld%lld%lld%lld%lld",&n,&m,&k,&a,&b,&c);
  20. int xx=max(n+k,m+k);
  21. for(int i=;i<=xx;i++)dp[i]=inf;
  22. //memset(dp,0x3f3f3f3f,sizeof(dp));
  23. dp[]=;
  24. for(int i=;i<=xx;i++){
  25. if(i>=)dp[i]=min(dp[i],dp[i-]+a);
  26. if(i>=)dp[i]=min(dp[i],dp[i-]+a);
  27. if(i>=)dp[i]=min(dp[i],dp[i-]+b);
  28. if(i>=)dp[i]=min(dp[i],dp[i-]+b);
  29. if(i>=)dp[i]=min(dp[i],dp[i-]+b);
  30. }
  31. ll ans=inf;
  32. //ans=min(ans,dp[m+k]+dp[n+k]);
  33. //ans=min(ans,dp[n]+dp[m]+k*c);
  34. //ans=min(ans,);
  35. for(int i=;i<=k;i++){
  36. ans=min(ans,dp[n+k-i]+dp[m+k-i]+i*c);
  37. }
  38. printf("%lld\n",ans);
  39. }
  40. return ;
  41. }

PASS

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Problem Description
有 n

个选手参加了 2050 编程竞赛,他们属于 m

个学校,学校的编号为 1

到 m

,2050 编程竞赛的 PASS 奖励资格如下:对于一个学校,如果它有 x

个学生参赛,它的参赛学生里成绩最好的 ⌊x/k⌋

人里,每有一个人总排名在前 50%

内(包括50%

),就奖励一个 PASS。

现在给出每个选手所属的学校和它的排名(假设没有平手),请你帮主办方算一下一共发出了几个 PASS。

 
Input
第一行一个正整数 T (1≤T≤10)

表示数据组数。

接下来 T

组数据,对于每组数据:

第一行三个正整数 n,m,k (1≤n≤104,1≤m≤103,2≤k≤20)

第二行 n

个数,按照成绩从好到差给出 n

个选手所属的学校。

 
Output
对于每组数据输出一行一个整数表示答案。
 
Sample Input
2
6 2 2
1 1 2 1 2 2
8 2 2
1 1 2 1 2 2 2 2
 
Sample Output
2
2
 
Source
Test Contest
题意:根据题目要求找pass的个数
题解:记录每个学校出现的次数in[i],然后统计前n/2里共有几个学生在自己学校占in[i]/k
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<vector>
  6. #include<queue>
  7. #include<cmath>
  8. #include<map>
  9. #include<set>
  10. using namespace std;
  11. typedef long long ll;
  12. int a[],in[],b[];
  13. int main(){
  14. int t;
  15. scanf("%d",&t);
  16. while(t--){
  17. int n,m,k;
  18. memset(in,,sizeof(in));
  19. memset(b,,sizeof(b));
  20. scanf("%d%d%d",&n,&m,&k);
  21. for(int i=;i<=n;i++){
  22. scanf("%d",&a[i]);
  23. in[a[i]]++;
  24. }
  25. int ans=;
  26. for(int i=;i<=n/;i++){
  27. if(b[a[i]]<in[a[i]]/k){
  28. //b[a[i]]++;
  29. ans++;
  30. }
  31. b[a[i]]++;
  32. }
  33. printf("%d\n",ans);
  34. }
  35. return ;
  36. }

冰水挑战

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Problem Description
Polar Bear Pitching helps you crystallize your message.
The stage could not be any cooler, and we mean literally:
a hole cut through the ice in the frozen Baltic Sea.

2050有一项很有挑战的活动 —— Polar Bear Pitching 。
体验人跳入冰水中讲述自己的恐惧,改变以及梦想。这是没有时间限制的演讲,就看你能在冰水中呆多久!

现在,我们要依次面对 n

个冰水挑战,每个挑战你都可以选择接受或不接受。接受第 i

个挑战会让你丧失 ai

点体力,因为每个挑战所处的环境不同,如果你要挑战它,在挑战它之前你的体力 x

会变成 min(x,bi)

,当你完成这个挑战的时候,你的体力会变成 x−ai

,体力任何时候不允许小于等于 0

,无论你是否接受第 i

个挑战,在这个挑战结束以后你的体力都会增加 ci

现在我们想知道最多可以完成多少个挑战。

 
Input
第一行一个正整数 T (T≤50)

表示数据组数。

接下来 T

组数据,每组第一行两个正整数 n,c (1≤n≤10^3,1≤c≤10^9)

,表示挑战的数量和初始体力,接下来 n

行,每行三个非负整数 ai,bi,ci(0≤ai,bi,ci≤109)

 
Output
对于每组数据输出一行一个数,表示你最多能完成几个挑战。
 
Sample Input
2
3 10
1 2 0
4 8 3
6 10 1
2 1
1 1 1
1 1 1
 
Sample Output
2
0
 
Source
Test Contest
题意:根据题目要求求出最多完成几个挑战
题解:又是一道dp(没学过dp的同学先跳过,继续口胡)dp[i][j]表示前i个挑战里完成了j个挑战剩余的最大体力值,最后检查dp[n][i],得到最大 i 即可
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<cstring>
  4. #include<cstdio>
  5. #include<vector>
  6. #include<queue>
  7. #include<cmath>
  8. #include<map>
  9. #include<set>
  10. using namespace std;
  11. typedef long long ll;
  12. const ll inf=1e15;
  13. ll dp[][];
  14. ll a[],b[],c[];
  15. int main(){
  16. int t;
  17. scanf("%d",&t);
  18. while(t--){
  19. ll n,C;
  20. scanf("%lld%lld",&n,&C);
  21. for(int i=;i<=n;i++){
  22. scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
  23. }
  24. memset(dp,-,sizeof(dp));
  25. dp[][]=C;
  26. for(int i=;i<=n;i++){
  27. for(int j=;j<=i;j++){
  28. if(dp[i-][j]!=-)dp[i][j]=max(dp[i][j],dp[i-][j]+c[i]);
  29. ll xx=-;
  30. if(j)xx=min(dp[i-][j-],b[i]);
  31. if(xx>a[i])dp[i][j]=max(dp[i][j],xx-a[i]+c[i]);
  32. }
  33. }
  34. int ans=;
  35. for(int i=n;i>=;i--){
  36. if(dp[n][i]>){
  37. ans=i;
  38. break;
  39. }
  40. }
  41. printf("%d\n",ans);
  42. }
  43. return ;
  44. }

2050 Programming Competition的更多相关文章

  1. 2050 Programming Competition (CCPC)

    Pro&Sol 链接: https://pan.baidu.com/s/17Tt3EPKEQivP2-3OHkYD2A 提取码: wbnu 复制这段内容后打开百度网盘手机App,操作更方便哦 ...

  2. [Benchmark] Codeflaws: A Programming Competition Benchmark for Evaluating Automated Program Repair Tools

    Basic Information Publication: ICSE'17 Authors: Shin Hwei Tan, Jooyong Yi, Yulis, Sergey Mechtaev, A ...

  3. 2021.7.27--Benelux Algorithm Programming Contest 2020 补提

    I Jigsaw 题目内容: 链接:https://ac.nowcoder.com/acm/contest/18454/I 来源:牛客网 You have found an old jigsaw pu ...

  4. AtCoder Beginner Contest 050 ABC题

    A - Addition and Subtraction Easy Time limit : 2sec / Memory limit : 256MB Score : 100 points Proble ...

  5. codeforces 710E E. Generate a String(dp)

    题目链接: E. Generate a String time limit per test 2 seconds memory limit per test 512 megabytes input s ...

  6. HDU4870_Rating_双号从零单排_高斯消元求期望

    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4870 原题: Rating Time Limit: 10000/5000 MS (Java/Other ...

  7. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  8. CodeForces - 417B (思维题)

    Crash Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status ...

  9. HDU 4870 Rating 概率DP

    Rating Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Statu ...

随机推荐

  1. springboot 多端口启动

    以eclipse(STS)为例, 选中项目右键Run Configurations 点击Spring Boot App,选中需要设定多端口项目,在启动参数一栏输入:-Dserver.port=7003 ...

  2. 洛谷P1073 最优贸易

    题面要求的是一个差值,即走过一条路径能找到的路径上最大值-最小值. 那么相当于跑一遍最长路和一遍最短路,当然不是概念上的最长路最短路,这里把dis[v]的松弛改成用路径上传递来的最大/最小值维护,而不 ...

  3. MapReduce实现Apriori算法

    Apiroi算法在Hadoop MapReduce上的实现 输入格式: 一行为一个Bucket 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 34 36 38 ...

  4. python 提取字符串中的指定字符 正则表达式

    例1: 字符串: '湖南省长沙市岳麓区麓山南路麓山门' 提取:湖南,长沙 在不用正则表达式的情况下: address = '湖南省长沙市岳麓区麓山南路麓山门' address1 = address.s ...

  5. js问题解决——cannot read property style of undefind

    当遇到cannot read property style of undefine的问题如下: 那就说明你设定的这个变量名为空 比如我在文档里写的属性名为list_box 但是我获取的属性名称写错了 ...

  6. Linux 设备驱动之字符设备

    参考转载博客:http://blog.chinaunix.net/uid-26833883-id-4369060.html https://www.cnblogs.com/xiaojiang1025/ ...

  7. grid-layout

    <!-- 创建三个网格布局--> .wrapper { <!--创建一个网格布局 --> display: grid; <!--创建3列 且每列都等距 --> gr ...

  8. python学习笔记:2.python基础

    4.27 01,pycharm 安装使用. 011,昨日内容回顾.     编译型:         将代码一次性全部编译成二进制,然后运行.         优点:执行效率高.         缺点 ...

  9. Mvaen仓库文件添加阿里镜像

    新手一枚,创建项目的时候下载Jar之类的特别慢,问过前辈才知道要去settings.xml里面增加一个阿里云服务.不添加这个的话是从国外的仓库下载,添加之后就能直接从国内下载了~ 步骤1:找到你的Ma ...

  10. malloc/free与new/delete的区别与联系

    相同点:(1)都是申请内存,释放内存,free和delete可以释放NULL指针:(2)都必须配对使用,这里的配对使用,可不能理解为一个new/malloc就对应一个delete/free,而是指在作 ...