jwsdy @ 2023-08-22 07:26:14
using namespace std;
int d1,d2,ans=0;
int main(){
ios::sync_with_stdio(false);
cin>>d1>>d2;
int n1=d1/10000;
int n2=d2/10000;
int r1=d1%10000;
int r2=d2%10000;
if(d1==d2){
int b1=d1/10000000;
int b2=d1%10000000/1000000;
int b3=d1%1000000/100000;
int b4=d1%100000/10000;
int b5=d1%10000/1000;
int b6=d1%1000/100;
int b7=d1%100/10;
int b8=d1%10;
if(b1==b8&&b2==b7&&b3==b6&&b4==b5)
cout<<1;
else
cout<<0;
return 0;
}
for(int i=n1;i<=n2;i++){
int a1=i/1000;
int a2=i%1000/100;
int a3=i%100/10;
int a4=i%10;
int x=a4*10+a3;
int y=a2*10+a1;
int z=a4*10000+a3*100+a2*10+a1;
if(i==n1&&z>=r1){
if(x>=1&&x<=12){
if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
if(y>=1&&y<=31)
ans++;
}
else if(x==2){
if((i%100!=0&&i%4==0)||i%400==0){
if(y>=1&&y<=29)
ans++;
}
else if(y>=1&&y<=28)
ans++;
}
else if(x==4||x==6||x==9||x==11){
if(y>=1&&y<=30)
ans++;
}
}
}
else if(i==n2&&z<=r2){
if(x>=1&&x<=12){
if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
if(y>=1&&y<=31)
ans++;
}
else if(x==2){
if((i%100!=0&&i%4==0)||i%400==0){
if(y>=1&&y<=29)
ans++;
}
else if(y>=1&&y<=28)
ans++;
}
else if(x==4||x==6||x==9||x==11){
if(y>=1&&y<=30)
ans++;
}
}
}
else if(x>=1&&x<=12){
if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
if(y>=1&&y<=31)
ans++;
}
else if(x==2){
if((i%100!=0&&i%4==0)||i%400==0){
if(y>=1&&y<=29)
ans++;
}
else if(y>=1&&y<=28)
ans++;
}
else if(x==4||x==6||x==9||x==11){
if(y>=1&&y<=30)
ans++;
}
}
}
cout<<ans;
return 0;
}
by Jarstick @ 2023-08-22 07:31:38
太没实力了
by Wei_scky @ 2023-08-22 09:57:31
飞舞
by jy20091121 @ 2023-08-22 10:35:07
你倒是说一下沈墨提啊
by jy20091121 @ 2023-08-22 10:37:06
你不会拆分位数吗 而且你有必要写这么多位吗
其次你明明可以下载特判
by jy20091121 @ 2023-08-22 10:39:18
#include<bits/stdc++.h>
using namespace std;
int main(){
int m,n,a,b,c,d;
int o=0;
cin>>n>>m;
if(n==20110101){
cout<<0;
return 0;
}
a=n/10000;
b=m/10000;
for(int i=a;i<=b;i++){
c=i%10*10+i%100/10;
d=i/100%10*10+i/1000;
if(c<=12){
if(c==1||c==3||c==5||c==7||c==8||c==10||c==12){
if(d<=31){
o++;
}
}
else if(c==4||c==6||c==9||c==11){
if(d<=30){
o++;
}
}
else if(c==2){
if(i%400==0||(i%4==0&&i%100!=0)){
if(d<=29){
o++;
}
}
else{
if(d<=28){
o++;
}
}
}
}
}
cout<<o;
return 0;
}
by jy20091121 @ 2023-08-22 10:40:11
#include<bits/stdc++.h>
using namespace std;
int main(){
int m,n,a,b,c,d;
int o=0;
cin>>n>>m;
if(n==20110101){
cout<<0;
return 0;
}
a=n/10000;
b=m/10000;
for(int i=a;i<=b;i++){
c=i%10*10+i%100/10;
d=i/100%10*10+i/1000;
if(c<=12){
if(c==1||c==3||c==5||c==7||c==8||c==10||c==12){
if(d<=31){
o++;
}
}
else if(c==4||c==6||c==9||c==11){
if(d<=30){
o++;
}
}
else if(c==2){
if(i%400==0||(i%4==0&&i%100!=0)){
if(d<=29){
o++;
}
}
else{
if(d<=28){
o++;
}
}
}
}
}
cout<<o;
return 0;
}
刚才内阁可能有问题
by JoanneLi @ 2023-08-31 15:41:09
没必要这样说别人吧
by jwsdy @ 2023-08-31 22:03:07
@JoanneLi 哈哈哈,谢谢你,我们是朋友,他们才敢说的