-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_If_21.cpp
More file actions
39 lines (39 loc) · 753 Bytes
/
Copy path02_If_21.cpp
File metadata and controls
39 lines (39 loc) · 753 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
#include <bits/stdc++.h>
using namespace std;
int main(){
double n;
double t;
cin >> n;
if(n>=10000000000){
t=n/1000000000;
cout << round(t)<< "B";
return 0;
}
if(n>=1000000000){
t=n/1000000000;
cout << round(t*10)/10.0 << "B";
return 0;
}
if(n>=10000000){
t=n/1000000;
cout << round(t) << "M";
return 0;
}
if(n>=1000000){
t=n/1000000;
cout << round(t*10)/10.0 << "M";
return 0;
}
if(n>=10000){
t=n/1000;
cout << round(t) << "K";
return 0;
}
if(n>=1000){
t=n/1000;
cout << round(t*10)/10.0 << "K";
return 0;
}
cout << n;
return 0;
}