60分求助
查看原帖
60分求助
375590
XZL_Jerry楼主2020/8/26 17:59
#include<bits/stdc++.h>
using namespace std;

int date1,date2,ans=0;
int a,b,c,d,e,f,g,h;

bool check(int x){
    a=x%10;x/=10;
    b=x%10;x/=10;
    c=x%10;x/=10;
    d=x%10;x/=10;
    e=x%10;x/=10;
    f=x%10;x/=10;
    g=x%10;x/=10;
    h=x%10;x/=10;
    if(a==h && b==g && c==f && d==e)
       return 1;
    else  return 0;
}

int main(){
    cin>>date1>>date2;
    for(int i=date1;i<=date2;i++){
        if(check(i))  ans++;
    }
    cout<<ans<<endl;
    return 0;
}
2020/8/26 17:59
加载中...