HDU 4515
刷水完毕,年月日,日日日日日日日日日日日日日日日日日日
#include <stdio.h>
int a[] = {,,,,,,,,,,,,};
const int Y = ,M = ,D = ;
int leap(int y)
{
if(y% == || (y%== && y%!=))
return ;
return ;
}
void deal1(int k)//前
{
int y = Y,m = M,d = D;
while(k--)
{
if(leap(y))
a[] = ;
else
a[] = ;
d--;
if(d<=)
{
m--;
if(m<=)
{
m = ;
y--;
}
d = a[m];
}
}
printf("%04d/%02d/%02d",y,m,d);
}
void deal2(int k)//后
{
int y = Y,m = M,d = D;
while(k--)
{
if(leap(y))
a[] = ;
else
a[] = ;
d++;
if(d>a[m])
{
m++;
if(m>)
{
m = ;
y++;
}
d = ;
}
}
printf("%04d/%02d/%02d ",y,m,d);
}
int main()
{
int n,m;
scanf("%d",&n);
while(n--)
{
scanf("%d",&m);
deal2(m);
deal1(m);
printf("\n");
}
return ;
}
HDU 4515的更多相关文章
- hdu 4515 年月份模拟题
小Q系列故事——世界上最遥远的距离 Time Limit: 500/200 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
随机推荐
- iOS开发之KVC全解
一 KVC的基本概念 1.KVC是Key Value Coding的缩写,意思是键值编码. 在iOS中,提供了一种方法通过使用属性的名称(也就是Key)来间接访问对象属性的方法,这个方法可以不通过g ...
- aspectC++常用命令
常用命令:1.ag++ main.cc //在工程目录下产生编译后的exe2.ag++ main.cc --weave_only //产生.acc 纯c++文件3.ag++ main.cc --gen ...
- bzoj 2599(点分治)
2599: [IOI2011]Race Time Limit: 70 Sec Memory Limit: 128 MBSubmit: 3642 Solved: 1081[Submit][Statu ...
- idea导入ssm项目启动tomcat报错404
用idea写ssm项目,基于之前一直在用spring boot 对于idea如何运行ssm花费了一番功夫 启动Tom act一直在报404 我搜了网上各种解决办法都不行,花费一天多的时间解决不了 就 ...
- ACM_名字的价值
名字的价值 Time Limit: 2000/1000ms (Java/Others) Problem Description: 集训终于开始了,参加集训的人很多,也就有很多名字,集训组织者发现了一件 ...
- max-age 和 Expires
网页的缓存是由HTTP消息头中的“Cache-control”来控制的,常见的取值有private.no-cache.max-age.must-revalidate等,默认为private. Ex ...
- javascript跨域的几种方法
以下的例子包含的文件均为为 http://www.a.com/a.html .http://www.a.com/c.html 与 http://www.b.com/b.html,要做的都是从a.htm ...
- 拖入浏览器读取文件demo
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 控件中出现的e.xxxx之类的
在遇到窗体应用程序开发的时候,会在控件事件的后台写一些代码,特别是带e.xxx什么的 C#中的Graphics g = e.Graphics是什么意思? 解释是: Graphics 这个类,比较特殊, ...
- sql server 还原数据库,数据库提示正在还原中的处理办法
还原数据库时,提示还原成功,可是数据库列表中该数据库显示正在还原中: 执行此命令即可: RESTORE DATABASE EnterPriseBuilding WITH RECOVERY 了解SQ ...