#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
int n,c = 0;
cin >> n;
for(int i = 1; i <= n; i++) {
if(i >= 1 && i <= 9) {
int t = i * i % 10;
if(t == i) c++;
} else if(i >= 10 && i <= 99) {
int t = i * i % 100;
if(t == i) c++;
} else if(i >= 100 && i <= 999) {
int t = i * i % 1000;
if(t == i) c++;
} else if(i >= 1000 && i <= 9999) {
int t = i * i % 10000;
if(t == i) c++;
} else if(i == 10000) {
int t = i * i % 100000;
if(t == i) c++;
}
}
cout << c << endl;
return 0;
}
1729 - 同构数C++东方博宜
最新推荐文章于 2024-07-17 20:43:45 发布