竞赛
考级
#include<bits/stdc++.h> using namespace std; bool huiwen(int i){ int sum=0; int aa=i; int b=i; while(b>0){ sum=b%10+sum*10; b/=10; } if(sum==aa)return 1; return 0; } int main(){ int a; cin>>a; for(int i=1;i<=a;i++){ if(huiwen(i)){ cout<<i<<"\n"; } } return 0; }
WA战神姜禹卓
#include <iostream> using namespace std; int main(){ int n; cin>>n; for (int i = 1; i <= n; ++i) { int a = 0; int s = i; while(s){ a = a*10+s%10; s = s/10; }if(a==i){ cout<<i<<endl; } } return 0; }
C++真真真难啊啊啊
acgoacgo
潜龙暗虎
#include<bits/stdc++.h> using namespace std; int n; int is_pal(int a) { int s=0; while(a) { s=s*10+a%10; a/=10; } return s; } int main() { cin>>n; for(int i=1;i<=n;i++) { if(is_pal(i)==i) cout << i << endl; } return 0; }
龙猫
毛奕程
6.
#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; }
许肄霄
༺ཌༀTN黑客ༀད༻
耐高总冠军 张文杰
s = int(input()) for i in range(1,s+1): st = str(i) if st==st[::-1]: print(st)
一只小羊
#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 <iostream> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++) { int s=0,m=i,p=i; while(m!=0) { s=s*10+m%10; m/=10; } if(s==p) cout<<i<<endl; } return 0; }
Voldemort
#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却一场空
共35条