题解 | #自守数#
自守数
https://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
#include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 0; int base = 10; for (int i = 0; i <= n; i++) { int m = i * i; if (i == base) base *= 10; if (m % base == i) ans++; } cout << ans; } // 64 位输出请用 printf("%lld")