JSZX @ 2017-11-09 21:37:52
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char** argv)
{
int t1, t2, m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int y1, m1, d1;
int y2, m2, d2;
bool b;
int i, a[5], c;
cin >> t1 >> t2;
y1 = t1 / 10000;
y2 = t2 / 10000;
m1 = t1 / 100 % 100;
m2 = t2 / 100 % 100;
d1 = t1 % 100;
d2 = t2 % 100;
for (i = y1, c = 0;i <= y2;i++)
{
b = i % 400 == 0 || i % 4 == 0 && i % 100 != 0;
m[2] += b;
a[0] = i % 10;
a[1] = i / 10 % 10;
a[2] = i / 100 % 10;
a[3] = i / 1000;
if (y2 - i > 0)
{
if (a[0] * 10 + a[1] <= 12)
{
if (a[0] * 10 + a[1] > m1)
{
if (a[2] * 10 + a[3] <= m[a[0] * 10 + a[1]])
c++;
}
else
{
if (a[0] * 10 + a[1] == m1)
if (a[2] * 10 + a[3] >= d1)
c++;
}
}
}
else
{
if (a[0] * 10 + a[1] > m1)
{
if (a[0] * 10 + a[1] < m2)
{
if (a[2] * 10 + a[3] <= m[a[0] * 10 + a[1]])
c++;
}
else
{
if (a[0] * 10 + a[1] == m2)
if (a[2] * 10 + a[3] <= d2)
c++;
}
}
else
{
if (a[0] * 10 + a[1] == m1)
if (a[2] * 10 + a[3] >= d1 && a[2] * 10 + a[3] <= m[a[0] * 10 + a[1]])
c++;
}
}
m[2] = 28;
}
cout << c << endl;
return 0;
}
by _不赦_ @ 2017-11-09 21:41:13
同学不要打这么多空格啦。。。。你的代码非常有建筑学美感。。。。。。你就告诉我错的是re还是wa还是tle。。。
by JSZX @ 2017-11-09 21:42:41
wa * 4
by _Aehnuwx @ 2018-01-28 14:46:59
@_不赦_ 打空格也可以啊,我有时候也这样写