#include<string>
#include<math.h>
#include<iostream>
using namespace std;
int main() {
string s;
cin >> s;
int indexOfE = s.find('E');
string baseNumber = s.substr(1, indexOfE - 1);
int exp = stoi(s.substr(indexOfE + 1));
int pointIndex = baseNumber.find('.');
baseNumber.erase(pointIndex, pointIndex);
if (exp < 0) {
for (int i = 0; i < abs(exp); i++) {
baseNumber = '0' + baseNumber;
}
baseNumber.insert(1, ".");
}
else {
int pointIndex = 1 + exp;
if (pointIndex < baseNumber.size()) {
baseNumber.insert(pointIndex, ".");
}
else {
while (pointIndex > baseNumber.size()) {
baseNumber += '0';
}
}
}
if (s[0] == '-') {
baseNumber = '-' + baseNumber;
}
cout << baseNumber << endl;
}
1073 Scientific Notation (20分)
最新推荐文章于 2020-10-23 11:44:12 发布