9 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int count = 0; for (int d = 1; d <= 9; d++) { long long num = 0; for (int length = 1; length <= 4; length++) { num = num * 10 + d; if (num <= n) { count++; } else { break; } } } cout << count << endl; return 0; }
Information
- ID
- 2886
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- # Submissions
- 20
- Accepted
- 10
- Uploaded By