-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1024.cpp
42 lines (34 loc) · 875 Bytes
/
1024.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
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
cin>>str;
if(str[0]=='+')cout<<"+";
else cout<<"-";
int pos_E=str.find('E',1);
bool MoreTen=true;
if(str[pos_E+1]=='-') MoreTen = false;
string substr=str.substr(1,pos_E-1);
substr=substr.erase(1,1);
// cout<<substr<<endl;
int index=stoi(str.substr(pos_E+2),nullptr,10);
//СÊýµã½øÐÐÒÆ¶¯
if(MoreTen==true)
{
if(index>=substr.size()-1)
{
int cnt_0=index-(substr.size()-1);
cout<<substr;
for(int i=0;i<cnt_0;i++)cout<<"0";
}
else
{
for(int i=0;i<=index;i++)
cout<<substr[i];
cout<<".";
for(int i=index+1;i<substr.size();i++)
cout<<substr[i];
}
}
}