-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path1073.cpp
More file actions
29 lines (28 loc) · 744 Bytes
/
1073.cpp
File metadata and controls
29 lines (28 loc) · 744 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
#include <iostream>
using namespace std;
int main() {
string str;
cin >> str;
int pos = str.find('E'), exp = stoi(str.substr(pos + 1));
if (str[0] == '-') cout << '-';
if (exp > 0) {
int i, count = 0;
cout << str[1];
for (i = 3; count < exp && i < pos; i++) {
cout << str[i];
count++;
}
if (count == exp && str[i] != 'E')
cout << '.' << str.substr(i, pos - i);
else
while (count++ < exp) cout << 0;
} else {
int count = 0;
exp *= -1;
cout << "0.";
while (count++ < exp - 1) cout << 0;
for (int i = 1; i < pos; i++)
if (str[i] != '.') cout << str[i];
}
return 0;
}