hly_hly @ 2016-11-26 23:10:38
#include<cstdio>
#include<iostream>
#include<algorithm>
int a,b,i,j,k,l,y1,y2,m1,m2,d1,d2,s,sum;
int t[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int fz(int x)
{
int k=0,ans=0;
while(x>0){
k=x%10;
ans=ans*10+k;
x/=10;
}
return ans;
}
int pd(int x){
if((x%4==0 && x%100!=0)||x%400==0)return 1;
return 0;
}
using namespace std;
int main()
{
scanf("%d%d",&a,&b);
printf("%d\n%d\n",fz(a),fz(b));
while(a<=b){
y1=a/10000;
m1=a/100%100;
d1=a%100;
if(a==fz(a))sum++;
if(pd(y1)==1)t[3]=29;
else t[3]=28;
if(d1<t[m1])
a++;
else if(d1==t[m1]&&m1<12)
a=a-t[m1]+1+100;
else if(d1==t[m1]&&m1==12)
a=a-t[m1]+1-1200+100+10000;
}
printf("%d",sum);
return 0;
}
by hly_hly @ 2016-11-26 23:15:33
抱歉(忘删调试)
#include<cstdio>
#include<iostream>
#include<algorithm>
int a,b,i,j,k,l,y1,y2,m1,m2,d1,d2,s,sum;
int t[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int fz(int x)
{
int k=0,ans=0;
while(x>0){
k=x%10;
ans=ans*10+k;
x/=10;
}
return ans;
}
int pd(int x){
if((x%4==0 && x%100!=0)||x%400==0)return 1;
return 0;
}
using namespace std;
int main()
{
scanf("%d%d",&a,&b);
while(a<=b){
y1=a/10000;
m1=a/100%100;
d1=a%100;
if(a==fz(a))sum++;
if(pd(y1)==1)t[3]=29;
else t[3]=28;
if(d1<t[m1])
a++;
else if(d1==t[m1]&&m1<12)
a=a-t[m1]+1+100;
else if(d1==t[m1]&&m1==12)
a=a-t[m1]+1-1200+100+10000;
}
printf("%d",sum);
return 0;
}
by Ikaros @ 2016-11-27 10:39:27
hh
by Keep_Dream @ 2016-11-27 12:00:49
身为蒟蒻竟然不知道去哪里查成绩的我一脸懵逼:你们是怎么知道成绩的
by MrMorning @ 2016-11-27 15:06:03
你们是怎么知道成绩的
by Viviltc @ 2016-11-27 20:45:43
因为洛谷这里是民间数据,没有真实数据那么精密
by Benss @ 2016-11-28 13:04:56
因为洛谷这里是民间数据
by PeiPei @ 2016-11-28 19:03:16
我也是好巧啊
by hly_hly @ 2016-11-28 23:02:37
那我怎么改??求大神帮忙****
by 姜澜 @ 2016-11-30 20:27:12
民间数据水啊
by CR_Raphael @ 2016-12-04 12:21:23
#include<iostream>
#include<cstdio>
using namespace std;
bool rn(int a){
int t;
t=a/10000;
if((t%4==0 && t%100!=0) || t%400==0)return true;
else return false;
}
bool ky(int a){
int t=a/100-a/10000*100,s=a%100;
if(t==2&&rn(a)==true)if(s<=29)return true;
if(t==1||t==3||t==5||t==7||t==8||t==10||t==12)if(s<=31)return true;
if(t==4||t==6||t==9||t==11)if(s<=30)return true;
return false;
}
bool hw(int a1,int a2,int a){
int k;
k=a*10000+a/1000+a/100%10*10+a/10%10*100+a%10*1000;
//cout<<k<<' '<<a<<endl;
if(k>=a1&&k<=a2&&ky(k)==true)return true;
else return false;
}
int main(){
//freopen("date.in","r",stdin);
//freopen("date.out","w",stdout);
int a1=0,a2=0,s=0,i;
cin>>a1>>a2;
if(a1>a2)swap(a1,a2);
for(i=a1/10000;i<=a2/10000;i++)if(hw(a1,a2,i)==true)s++;
cout<<s<<endl;
//fclose(stdin);
//fclose(stdout);
return 0;
}