2 solutions
- 1
Information
- ID
- 47
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 8
- Tags
- # Submissions
- 14
- Accepted
- 9
- Uploaded By
C++ :
#include <algorithm>
#include <cstdio>
using namespace std;
int n, ans;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int v = i % 10, t = i / 10, chk = 1;
while (t) {
if (t % 10 != v) chk = 0;
t /= 10;
}
ans += chk;
}
printf("%d\n", ans);
return 0;
}
By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.