-
Notifications
You must be signed in to change notification settings - Fork 6
/
toi01_roman.cpp
46 lines (39 loc) · 912 Bytes
/
toi01_roman.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
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9 + 7
int i,v,x,l,c;
void rm(int n)
{
if(n>=300) c+=3;
else if(n>=200) c+=2;
else if(n>=100) c++;
n%=100;
if(n>=90){ x++; c++; }
else if(n>=80){ l++; x+=3; }
else if(n>=70){ l++; x+=2; }
else if(n>=60){ l++; x++; }
else if(n>=50) l++;
else if(n>=40){ l++; x++; }
else if(n>=30) x+=3;
else if(n>=20) x+=2;
else if(n>=10) x++;
n%=10;
if(n==9){ i++; x++; }
else if(n==8){ v++; i+=3; }
else if(n==7){ v++; i+=2; }
else if(n==6){ v++; i++; }
else if(n==5) v++;
else if(n==4){ v++; i++; }
else if(n==3) i+=3;
else if(n==2) i+=2;
else if(n==1) i++;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
for(int ix = 1;ix <= n;ix++) rm(ix);
cout << i << ' ' << v << ' ' << x << ' ' << l << ' ' << c;
}