1 solutions
-
0
#include<bits/stdc++.h> using namespace std; bool check(int x,int b,string &t) { string s; while(x) { int t=x%b; if(t>=10) s=s+char(t-10+'A'); else s=s+char(t+'0'); x/=b; } string s1=s; reverse(s1.begin(),s1.end()); t=s1; if(s1==s) return true; return false; } int main() { int b; cin>>b; for(int i=1;i<=300;i++) { string s; string t; check(i,b,t); if(check(i*i,b,s)) { cout<<t<<" "<<s<<endl; } } return 0; }
- 1
Information
- ID
- 2863
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 8
- Accepted
- 2
- Uploaded By