LT1089 @ 2024-08-11 09:12:37
不懂哪里错了(是样例太水?)
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b;
struct date
{
ll year;
ll month;
ll day;
};
date tmp,goal;
ll num[1000010];
ll cc;
ll md[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
date sepdt(ll edon)
{
date a;
a.day=edon%100;
edon/=100;
a.month=edon%100;
edon/=100;
a.year=edon;
return a;
}
ll tdpes(date node)
{
ll a;
a+=node.year;
a*=100;
a+=node.month;
a*=100;
a+=node.day;
return a;
}
bool ech(ll y)
{
if (y%400==0)
{
return true;
}
if (y%100==0)
{
return false;
}
if (y%4==0)
{
return true;
}
return false;
}
bool orz(ll x,ll cnt)
{
ll c=x;
for (ll i=1;i<=cnt;i++)
{
num[i]=c%10;
c/=10;
}
for (ll i=1,j=cnt;i<j;i++,j--)
{
if (num[i]!=num[j])
{
return false;
}
}
return true;
}
int main()
{
cin>>a>>b;
tmp=sepdt(a);
goal=sepdt(b);
while (tmp.day<goal.day||tmp.month<goal.month||tmp.year<goal.year)
{
ll ans;
if (ech(tmp.year))
{
md[2]=29;
}
else
{
md[2]=28;
}
if (tmp.day>md[tmp.month])
{
tmp.day=1;
tmp.month++;
}
if (tmp.month>12)
{
tmp.year++;
tmp.month=1;
tmp.day=1;
}
ans=tdpes(tmp);
if (orz(ans,8))
{
cc++;
}
tmp.day++;
}
cout<<cc;
return 0;
}
by CheeseFunction @ 2024-08-11 09:23:51
你要考虑起始点与终止点是同一个的情况啊,譬如测试点一就是
( 还有,测试点不可能给你太毒瘤的,不然还怎么坑你嘞)
by han1219 @ 2024-08-12 15:03:13
请问你判断闰年了吗?
by han1219 @ 2024-08-12 15:03:51
@LT1089