P11680 题解
getchar_unlocked · · 题解
题目传送门
思路
注意到
判断方法:先将数字
AC CODE
#include<bits/stdc++.h>
using namespace std;
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
bool check(int x){
string s=to_string(x);
int n=s.size();
if(!(n&1))
return false;
return s[0]==s[n-1]&&s[0]==s[n/2];
}
int main(){
int T=read();
while(T--){
int l=read(),r=read();
for(int i=l;i<=r;++i)
if(check(i))
printf("%d ",i);
printf("\n");
}
return 0;
}