-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtremelyRound.cpp
41 lines (35 loc) · 949 Bytes
/
ExtremelyRound.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
using namespace std;
int main(){
int a; cin >> a;
for (int i = 0; i < a; i++) {
int input; cin >> input;
if (input <= 10) {
cout << input << endl;
} else {
// 500
int count = 9;
for (int j = 10; j < input; j*=10) {
for (int k = j; k < j*10; k+=j) {
if (k <= input) {
count++;
} else {
break;
}
// cout <<k<< endl;
}
if ((j*10) == input) {
count++;
}
}
cout << count << endl;
// if (input % 10 == 0) {
// cout << 9 + (input / 10) << endl;
// }
// else {
// cout << 9 + (input / 10)
// }
}
}
return 0;
}