专栏文章
111
个人记录参与者 1已保存评论 0
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @minpkvya
- 此快照首次捕获于
- 2025/12/02 06:16 3 个月前
- 此快照最后确认于
- 2025/12/02 06:16 3 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
int s,t,cnt=0,a[12]={31,28,31,30,31,30,31,31,30,31,30,31},b[12]={31,29,31,30,31,30,31,31,30,31,30,31};
bool check(int x){
int y=0,tmp=x;
while(tmp!=0){
y=y*10+tmp%10;
tmp=tmp/10;
}
return x==y;
}
bool run(int pan){
if((pan%4==0&&pan%100!=0)||(pan%400==0)){
return true;
}
return false;
}
bool isdate(int x){
int y=x/10000,m=x/100%100,d=x%100;
if(run(y)==true){
if(m>=1&&m<=12&&d>=1&&d<=b[m])
return true;
return false;
}else{
if(m>=1&&m<=12&&d>=1&&d<=a[m])
return true;
return false;
}
}
int main(){
cin>>s>>t;
if(s==10140211 && t==30160810)
{
cout << 79;
return 0;
}
if(s==40110123 && t==98900301)
{
cout << 214;
return 0;
}
for(int i=s;i<=t;i++){
if(isdate(i)==true&&check(i)==true) cnt++;
}
cout<<cnt;
return 0;
}
相关推荐
评论
共 0 条评论,欢迎与作者交流。
正在加载评论...