题解 | #守形数#
守形数
https://www.nowcoder.com/practice/99e403f8342b4d0e82f1c1395ba62d7b
#include <iostream> using namespace std; int main() { int a, b, tmp; while (cin >> a) { // 注意 while 处理多个 case b = a * a; tmp = 0; for(int base = 1; tmp < a; base *= 10, b /= 10) { tmp += base * (b % 10); } cout << (a == tmp ? "Yes!" : "No!") << endl; } } // 64 位输出请用 printf("%lld")