You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
493 B
30 lines
493 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
//是不是同构数
|
|
bool isTongGou(int n) {
|
|
int a = n * n;
|
|
bool res = true;
|
|
while (n) {
|
|
int b = n % 10;
|
|
n /= 10;
|
|
|
|
int c = a % 10;
|
|
a /= 10;
|
|
if (b != c) {
|
|
res = false;
|
|
break;
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++)
|
|
if (isTongGou(i)) cout << i << " ";
|
|
|
|
return 0;
|
|
} |