rt,本蒟蒻做一道普及−的题目(我太菜了,这都不会),好多WA,甚至还有一个TLE,求助
代码:
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a,b,d=0;
string c;
cin>>a>>b;
for(int i=a;i<=b;i++){
c=to_string(i);
if(c.length()%2==0){
for(int l=0;l<=c.length()/2-1;l++){
if(c[l]==c[c.length()-1-l]){
d+=2;
}
}
if(c.length()==d){
d=0;
for(int l=2;l<i;l++){
if(i%l==0){
d+=1;
}
}
if(d==0){
cout<<c<<endl;
}
d=0;
}
}else{
for(int l=0;l<c.length()/2;l++){
if(c[l]==c[c.length()-1-l]){
d+=2;
}
}
if(c.length()-1==d){
d=0;
for(int l=2;l<i;l++){
if(i%l==0){
d+=1;
}
}
if(d==0){
cout<<c<<endl;
}
d=0;
}
}
}
return 0;
}