Skip to content

Commit 7bc541f

Browse files
1748 solved!
1 parent f04abf6 commit 7bc541f

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int a = 99999;
6+
a /= 10;
7+
a /= 10;
8+
a /= 10;
9+
a /= 10;
10+
cout << a << endl;
11+
return 0;
12+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
ios_base::sync_with_stdio(false);
6+
cin.tie(nullptr);
7+
8+
// 1 <= N <= 100,000,000 = 10^8
9+
int N;
10+
cin >> N;
11+
12+
int size = 1;
13+
for (; size < 100000001; size = size * 10)
14+
if ((N / size) < 10)
15+
break;
16+
17+
int index = 0;
18+
int cp_size = size;
19+
while (cp_size > 9) {
20+
index++;
21+
cp_size /= 10;
22+
}
23+
24+
//cout << "[DEBUG] size = " << size << "\t index = " << index << '\n';
25+
26+
int result = (index + 1) * (N - size + 1);
27+
while (index > 0) {
28+
result += index * (size / 10 * 9);
29+
size /= 10;
30+
index--;
31+
}
32+
33+
cout << result << '\n';
34+
35+
return 0;
36+
}
Binary file not shown.

0 commit comments

Comments
 (0)