字符串处理
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(){
string s;
cin >> s;
if(s.empty()) return 0;
bool neg = false;
if(s[0] == '-'){
neg = true;
s = s.substr(1);
}else if(s[0] == '+'){
s = s.substr(1);
}
auto pos = s.find('E');
string left = s.substr(0, pos);
string right = s.substr(pos+1);
bool less = false;
if(right[0] == '-'){
less = true;
right = right.substr(1);
}else if(right[0] == '+'){
right = right.substr(1);
}
int exp = atoi(right.c_str());
if(less){
auto pos = left.find('.');
for(int i = pos; i <= exp; ++i){
left = "0"+left;
pos = pos+1;
}
for(int i = 0; i < exp; ++i){
swap(left[pos], left[pos-1]);
pos = pos-1;
}
}else{
auto pos = left.find('.');
int n = left.size() - (pos+1);
for(int i = n; i < exp; ++i)
left = left + "0";
for(int i = 0; i < exp; ++i){
swap(left[pos], left[pos+1]);
pos = pos + 1;
}
if(left.find('.') == left.size()-1){
left = left.substr(0, left.size()-1);
}
}
if(neg) printf("-");
printf("%s", left.c_str());
return 0;
}