'commit'
This commit is contained in:
30
TangDou/ShuLun/SL1.cpp
Normal file
30
TangDou/ShuLun/SL1.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user