-
Notifications
You must be signed in to change notification settings - Fork 1
/
P10101.cpp
59 lines (54 loc) · 982 Bytes
/
P10101.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
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef unsigned long long ul;
#define KUTI 10000000
#define LAKH 100000
#define HAJAR 1000
#define SHATA 100
void print(ul n) {
ul kutis = n / KUTI;
if(kutis > 0) {
print(kutis);
printf(" kuti");
}
n = n % KUTI;
// lakh
ul lakh = n / LAKH;
if(lakh > 0) {
printf(" %llu lakh", lakh);
}
n = n % LAKH;
// hajar:
ul hajar = n / HAJAR;
if(hajar > 0) {
printf(" %llu hajar", hajar);
}
n = n % HAJAR;
// shata:
ul shata = n / SHATA;
if(shata > 0) {
printf(" %llu shata", shata);
}
n = n % SHATA;
if(n > 0)
printf(" %llu", n);
}
/*
'kuti' (10.000.000), 'lakh' (100.000), 'hajar' (1.000), 'shata' (100)
n < 999.999.999.999.999
*/
int main() {
ul n;
for(int cas = 1; cin >> n; ++cas) {
printf("%4d.", cas);
// 10 mill's:
if(n == 0)
printf(" 0");
else
print(n);
printf("\n");
}
return 0;
}