竞赛
考级
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n; for(int i=1;i<=n;i++){ m=i; int s=0; while(m){ s=s*10+m%10; m/=10; } if(s==i) cout<<i<<endl; } }
源初
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ int y=i,x=0; while(y!=0){ x=x*10; x+=y%10; y=y/10; } if(x==i) cout<<i<<endl; } }
紫薇-五年级lty(必回关)
n = int(input()) def isN(n): t = n s = 0 while t: s=s*10+t%10 t//=10 if n == s: return True return False for i in range(1,n+1): if isN(i): print(i)
今晚打老虎
#include<bits/stdc++.h> using namespace std; int n; int main(){ cin>>n; for (int i = 1; i <= n; ++i) { int x = 0; int s = i; while(s>0){ x = x*10+s%10; s = s/10; }if(x==i){ cout<<i<<endl; } } return 0; }
CHN
#include <iostream> using namespace std; int main(){ int n; cin>>n; for (int i = 1; i <= n; ++i) { int x = 0; int s = i; while(s>0){ x = x*10+s%10; s = s/10; }if(x==i){ cout<<i<<endl; } } return 0; }
红蝶
来c4柠檬了哟
#include <bits/stdc++.h> using namespace std; int p(int a){ int e=a; int r=0; while (a>0){ r=r*10+a%10; a/=10; } return e==r; } int main() { int s=0,n; cin>>n; for(int i=1;i<=n;i++){ if(p(i)!=0) { cout<<i<<endl; } } return 0; }
左峻豪
LS_YZY
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ int x=0; int s=i; while(s>0){ x=x*10+s%10; s=s/10; } if(x==i){ cout<<i<<endl; } } return 0; }
曹汇煦
zsy
有事找大号
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for (int i = 1; i <= n; ++i) { int x = 0; int s = i; while(s>0){ x = x*10+s%10; s = s/10; }if(x==i){ cout<<i<<endl; } } return 0; }
霄
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ int x=0; int t=i; while(t){ x=x*10+t%10; t/=10; } if(x==i)cout<<i<<endl; } return 0; }
菜
majmDZB
#include<bits/stdc++.h> using namespace std; bool func(int x){ string s = to_string(x); string rev_s = s; reverse(s.begin(),s.end()); return rev_s == s; } int main(){ int n; cin >> n; for(int i = 1;i <= n;i++){ if(func(i))cout << i << endl; } return 0; }
dfs却一场空
共55条
提交答案之后,这里将显示提交结果~