判断两个日期相差多少天
来源:互联网 发布:sql两表关联查询 编辑:程序博客网 时间:2024/05/08 10:28
#include <iostream>using namespace std;#define ISYEAR(x) x%100!=0 && x%4==0 || x%400==0?1:0int dayOfMonth[13][2]={ 0,0, 31,31, 28,29, 31,31, 30,30, 31,31, 30,30, 31,31, 31,31, 30,30, 31,31, 30,30, 31,31};struct Date{ int Day; int Month; int Year; void nextDay(){ Day++; if(Day>dayOfMonth[Month][ISYEAR(Year)]){ Day=1; Month++; if(Month>12){ Month=1; Year++; } } }};int buf[5001][13][32];int Abs(int x){ return x>0?x:-x;}int main(){ Date tmp; int cnt=0; tmp.Day=1; tmp.Month=1; tmp.Year=0; while (tmp.Year!=5001) { buf[tmp.Year][tmp.Month][tmp.Day]=cnt; tmp.nextDay(); cnt++; } int d1,m1,y1; int d2,m2,y2; while (scanf("%4d%2d%2d",&y1,&m1,&d1)!=EOF) { scanf("%4d%2d%2d",&y2,&m2,&d2); cout<<Abs(buf[y2][m2][d2]-buf[y1][m1][d1]+1)<<endl; } return 0;}
阅读全文
0 0
- Java 判断两个日期相差多少天
- Java 判断两个日期相差多少天
- 判断两个日期相差多少天
- jquery判断两个日期之间相差多少天
- js判断两个日期之间相差多少天
- java计算两个日期相差多少天
- 计算两个日期相差多少天!
- 比较两个日期相差多少天
- 判断两个时间相差多少天多少分多少秒
- PHP判断两个日期之间相差多少个月份
- excel中计算两个日期之间的相差多少天
- Java 计算两个日期直接相差多少天
- php计算两个日期相差多少天(日)…
- 取得两个日期之间的相差多少天
- java计算两个日期相差多少天小时分钟等
- 算法:输入两个日期,求之间相差了多少天
- 真正准确的“两个日期相差多少天”函数
- 使用LocalDate计算两个日期相差多少天
- 【centos】php5.4升级到php5.6
- Linux 参看cuda 及 显卡
- 安卓中的线程
- Android 使用Rtmp音视频推流
- wamp2.5 cert.pem 不起作用 HTTPS 造成ssl60问题
- 判断两个日期相差多少天
- [一天几个linux命令] 计算机硬件的五大单元
- Tensorflow使用笔记(1) 怎么保存和使用训练好的参数和模型
- CodeFroces 812B Sagheer, the Hausmeister(BFS)
- Fast RCNN算法详解
- Centos6.8下搭建SVN服务器
- 《六》微信支付
- 需要掌握的技能有哪些
- LeetCode 525. Contiguous Array