题解 | 特殊的科学计数法
特殊的科学计数法
https://www.nowcoder.com/practice/ca0962879d3b40d8bb598fb9a905ac7a
#include <iostream>
#include <string>
using namespace std;
int main() {
string n;
cin>>n;
int l=n.length(), e=l-1;
int a=n[0]-'0', b=0;
if(l>1) b=n[1]-'0';
if(l>2 && n[2]>='5') b++;
if(b==10){
b=0;
a++;
}
if(a==10){
a=1;
e++;
}
cout<<a<<'.'<<b<<"*10^"<<e<<endl;
return 0;
}