题目描述
星系炸弹 - 蓝桥云课 (lanqiao.cn)
题目分析
对于此题目一一枚举即可
#include<bits/stdc++.h>
using namespace std;
bool is_r(int n)
{
if((n % 4 == 0 && n % 100 != 0)|| n % 400 == 0)return true;
return false;
}
int mm[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
int y = 2014, m = 11, d = 9;
int q = 1000;
if(is_r(y))mm[2] = 29;
else mm[2] = 28;
while(q --)
{
if(d + 1 <= mm[m])
{
d = d + 1;
}
else
{
if(m + 1 <= 12)
{
m ++;
d = 1;
}
else
{
y ++;
if(is_r(y))mm[2] = 29;
else mm[2] = 28;
m = 1;
d = 1;
}
}
}
printf("%04d-%02d-%02d", y, m, d);
return 0;
}