文章
34
粉丝
316
获赞
10
访问
24.2k
#include<bits/stdc++.h>
using namespace std;
//用于判断是不是闰年
int Judge(int x)
{
if (x % 400 == 0 || (x % 100 != 0 && x % 4 == 0)) return 1;
return 0;
}
//计算当前日期在当年一共有多少天
int GetDay(int x)
{
int year, month, day, result;
result = 0;
year = x / 10000;
day = x % 100;
month = (x % 10000 - day) / 100;
for (int i = 1; i < month; i++)
{
if (i == 2)
{
if (Judge(year)) result += 29;
else result += 28;
}
else if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) result += 31;
&...
登录后发布评论
暂无评论,来抢沙发