-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoring-Apartments.cpp
More file actions
53 lines (48 loc) · 811 Bytes
/
Boring-Apartments.cpp
File metadata and controls
53 lines (48 loc) · 811 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
#include<bits/stdc++.h>
using namespace std;
int lastDigit(int n)
{
n=n%10;
return n;
}
int countDigit(int n)
{
int count = 0;
while (n != 0)
{
n = n / 10;
++count;
}
return count;
}
int main()
{
int test;
cin>>test;
for(int i=0;i<test;i++)
{
int num;
cin>>num;
int m=lastDigit(num);
int sum=((m-1))*10;
int lenght=countDigit(num);
switch (lenght)
{
case 1:
cout<<sum+1<<endl;
break;
case 2:
cout<<sum+3<<endl;
break;
case 3:
cout<<sum+6<<endl;
break;
case 4:
cout<<sum+10<<endl;
break;
default:
break;
}
}
return 0;
}