"科林明伦杯"哈尔滨理工大学第六届程序设计团队赛总结
来源:互联网 发布:航海家全套公式源码 编辑:程序博客网 时间:2024/05/01 12:51
水题就不写了,写几道有意思的。。
题目:
B.TimeTime Limit: 1000 MSMemory Limit: 100000 KTotal Submit: 1458 (431 users)Total Accepted: 322 (310 users)Special Judge: NoDescriptionKim是一个掌控时间的大师。不同于一般人,他习惯使用秒来计算时间。如果你问他现在是几点,他会告诉你现在是今天的xxxx秒。Mik想要考考Kim。他想知道从某一天的00:00:00开始,经过s秒后是哪一天。但是Mik不会计算答案,他需要你的帮助。
注意:我们认为一天从00:00:00开始,到23:59:59结束。00:00:00经过1秒后是00:00:01;从00:00:00开始,加86400(60*60*24)秒后就是下一天的00:00:00.
Input第一行一个整数T表示数据组数。
接下来T行,每行一个日期yyyy-MM-dd,接下来一个整数s表示s秒。
Output对于每个输入,输出一行yyyy-MM-dd 表示答案。对于不足两位的数要补齐前导0。
Sample Input32016-12-10 10002016-02-28 864002016-01-01 1000000Sample Output
2016-12-102016-02-292016-01-12Hint
T<=100
s<=2147483647
日期在1800-01-01到2100-01-01之间
闰年的判断:
1.能被4整除且不能被100整除的为闰年.
2.能被400整除的是闰年.
代码:(标程写的就是妙。。)
#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <iostream>using namespace std;bool runnian(int year)//判断是否是闰年{ if ((year%4==0 && year%100!=0) || year%400==0) return 1; return 0;}int maxday(int year,int month)//判断一个月的最大天数{ if (month==2) { if (runnian(year)) return 29; else return 28; } else { if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) return 31; else return 30; }}int main (){ int t; int year,month,day; int s; scanf("%d",&t); while (t--) { scanf("%d-%d-%d %d",&year,&month,&day,&s); int ad=s/86400.0;//一天是86400秒,判断有几天 for(int i=1; i<=ad; i++)//从1循环到这一天 { day++; if (day>maxday(year,month)) { day=1; month++; } if (month==13) { month=1; year++; } } printf("%d-%.2d-%.2d\n",year,month,day); } return 0;}C.IDTime Limit: 1000 MSMemory Limit: 1000000 KTotal Submit: 1421 (405 users)Total Accepted: 264 (247 users)Special Judge: NoDescription
It is very cold in Harbin in the winter, but it is pretty warm in the Zhengxin Building. Today is Saturday, Teacher ABG want to play a trick on the only one student called NWL because he didn’t finish the MOOC.
At the beginning, every student is in the building. The teacher calls some students to sweep the snow on the playground out of the building, and sometimes he also call some students who are on the playground back to the building. At last, teacher ABG wants to leave only one student, NWL, on the playground out of the building. It means that the teacher ABG calls NWL’s ID ODD times, but called other students’ ID EVEN times, maybe more than twice. Now give you the list describing the students’ ID which the teacher called in order, please tell us NWL’s ID.
InputThe first line is an integer T, describes the number of tests. Then T tests.
In each test, the first line is an integer N, describes the number of IDs on the list.
Then followed N lines, each line contains an integer M, describes one ID on the list.
OutputT lines. Each line, an integer, the NWL’s ID.
Sample Input3311403100001140310000114031000011140310002512222Sample Output
114031000011403100021Hint
1<=T<=10
1<=N<=1,000,000
1<=M<=1,159,999,999
The sum of N in the input file is no more than 3,000,000, all the input are integers and correct.
代码:
这道题和NYOJ上的找球号(三)基本一样,利用位运算的异或
#include<iostream>#include<cstdio>#include<ctime>#include<cstdlib>using namespace std;int m,t;int n;int ans;int main(){ scanf("%d",&t); while(t--) { ans=0; scanf("%d",&m); for(int i=1; i<=m; i++) { scanf("%d",&n); ans^=n; } printf("%d\n",ans); } return 0;}D.GameTime Limit: 1000 MSMemory Limit: 100000 KTotal Submit: 498 (184 users)Total Accepted: 141 (137 users)Special Judge: NoDescription
Kim is a college student who love computer games, but unfortunately his school just published a rule that Games should disappear in the campus , that means nobody can play computer games in school, including the students dormitory. However, the student don’t take it seriously, that’s why the manager of the school gets so angry that he decided to go to the dormitory to punish the students. You should know the manager will punish those students who is playing games at the moment he enter the room, and leave immediately if nobody is playing game in this room.
Kim is a talented game player , in fact, he is the Carry of a famous Gaming club, so he needs time to practice he’s skills . And luckily , Kim’s roommate Mik is a Geek(also a Kim fan), he hacked the manager’s computer and get the timetable of the manager, and tell Kim when will the manager come to their room tomorrow. A big E-sport Event is around the corner, so Kim list m skills he should practice, each skill takes some time to practice and improve Kim’s skill by some points. You should calculate the max total improvement points Kim can get. Note any skills can be practiced any times , including 0.
InputThe first line contains a integer T ( T <= 10 ), then T cases follows.
In each case, there are 3 parts of input.
The first part contains 3 integers L, n, m in a single line.Range[0, L] is the time Kim decide to practice , n is the times manager would enter his room, m indicate the total number of the skills.
The second part contains n integers ti(0 <= ti <= L) in a single line, means the manager would enter his room at ti. Note that ti is giving in the increasing order.
The third part has m lines , each line contains two integers ci, vi, means this skill needs ci minutes to practice and can make vi points improvement.
L<=500, n<=10, m<=100.
For each case, you should output the max points Kim can improve.
Sample Input26 1 332 32 42 56 2 32 42 32 42 5Sample Output
1015Hint
Note that Kim will be catch playing games any time in the interval of his practicing, excluded the beginning and the ending of each practice time.
Sample 1:
Sample 2:
SubmitMessage代码:
这道题是多区间完全背包,把每个区间的最优解加起来就行
#include <stdio.h>#include <string.h>#include <iostream>#include <math.h>#include <stack>#include <queue>#include <vector>#include <algorithm>#define mem(a,b) memset(a,b,sizeof(a))using namespace std;int a[12];int c[101];int v[101];int dp[10000];int l,m,n;void bag(int n)//完全背包{for(int i=1;i<=m;i++)for(int j=c[i];j<=n;j++)dp[j]=max(dp[j],dp[j-c[i]]+v[i]);//当前的区间的最优解}int main(){int t;scanf("%d",&t);while(t--){ int s=0;scanf("%d%d%d",&l,&n,&m);for(int i=1;i<=n;i++)scanf("%d",&a[i]);a[0]=0,a[n+1]=l;for(int i=1;i<=m;i++)scanf("%d%d",&c[i],&v[i]);for(int i=0;i<=n;i++){mem(dp,0);int h=a[i+1]-a[i];bag(h);s+=dp[h];}printf("%d\n",s );}return 0;}E.ModTime Limit: 1000 MSMemory Limit: 100000 KTotal Submit: 1929 (435 users)Total Accepted: 138 (134 users)Special Judge: NoDescription
Kim刚刚学会C语言中的取模运算(mod)。他想要研究一下一个数字A模上一系列数后的结果是多少。帮他写个程序验证一下。
Input第一行一个整数T代表数据组数。
接下来T组数据,第一行一个整数n,接下来n个数字ai
接下来一行一个整数m,接下来m个数字bi。
Output对于每个bi,输出bi%a1%a2%...%an 。
Sample Input1410 9 5 7514 8 27 11 25Sample Output
43210Hint
在C语言中,A mod B 是 a%b
样例解释:
14%10%9%5%7=4
8%10%9%5%7=3
...
数据范围:
1<=n<=100000
1<=m<=100000
1<=ai<=1000000000
0<=bi<=1000000000
SubmitMessage代码:
暂时不会,听说跟HDU5875一样,等我做了再说
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛总结
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛总结
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛(12.10)
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛(流水账)
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛 HRBUST 2315 Time(水)
- 科林明伦杯哈尔滨理工大学第七届程序设计团队赛-水题*2
- 科林明伦杯哈尔滨理工大学第七届程序设计团队赛-Aggie’s Tasks
- “科林明伦杯”哈尔滨理工大学第七届程序设计团队赛 G.Sorting(贪心,思路)
- 科林明伦杯”哈尔滨理工大学第七届程序设计团队赛G
- “科林明伦杯”哈尔滨理工大学第七届程序设计团队赛 A. An Easy Geometry Problem(计算几何)
- “科林明伦杯”哈尔滨理工大学第七届程序设计团队赛 I.Aggie’s Tasks(带权的LIS)
- “科林明伦杯”哈尔滨理工大学第七届程序设计团队赛 I.Aggie’s Tasks(带权的LIS)
- 哈尔滨理工大学第六届程序设计团队赛网络同步赛
- 哈尔滨理工大学第六届程序设计团队赛—H
- 哈尔滨理工大学第六届程序设计团队赛—C
- 哈尔滨理工大学第六届程序设计团队赛—D
- 哈尔滨理工大学第六届程序设计团队赛G OX(博弈搜索)
- 【HIVE】hive相关报错处理${system:java.io.tmpdir}等
- tomcat配置JDK
- NPOI vs EPPlus 导出Excel简单对比
- 2——快速开始Sequential模型
- 框模型/盒子模型
- "科林明伦杯"哈尔滨理工大学第六届程序设计团队赛总结
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- 机器学习之—线性模型
- myeclise10.5集成checkStyle
- sourcetree 推送项目
- JDBC和数据库事务详解(二)
- androidstudio小知识记录-Genymotion安装与使用
- RecyclerView嵌套滑动冲突处理
- No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案