Scientific notation is a convenient way for scientists to represent large or small numbers, satisfying regular expressions [+-][1-9]. " [0-9]+e[+-][0-9]+, that is, the integer portion of the number is only 1 bits, and the fractional part has at least 1 digits, and the sign of the number and its exponential portion is definitely given even for positive numbers.
The real number A is given in the format of the scientific notation, and the program is programmed to output a in normal numeric notation and to ensure that all valid bits are preserved.
Input format:
Each input contains 1 test cases, a real number a in scientific notation. The number is stored for no more than 9999 bytes and the absolute value of its exponent does not exceed 9999.
Output format:
For each test case, output a in a line of normal numeric notation and ensure that all valid bits are retained, including the end of 0.
Input Sample 1:
+1.23400E-03
Output Example 1:
0.00123400
Input Sample 2:
-1.2E+10
Output Example 2:
-12000000000
It's so annoying to simulate ...
#include <iostream>#include<sstream>#include<cmath>#include<vector>#include<string>using namespacestd;intMain () {intI, J, M, N, Mark, value1, K, value2; stringS1, Zhishu =""; CIN>>S1; if(s1[0] =='+'){ for(i =1; I < s1.length (); i++){ if(S1[i] = ='E') {Mark=i; Break; } } for(j = Mark +2; J < S1.length (); J + +) {Zhishu= Zhishu +S1[j]; } value1=atoi (Zhishu.c_str ()); if(s1[mark+1] =='-') {cout<<0<<"."; Value1--; while(value1) {cout<<0; Value1--; } for(M =1; M < mark; m++){ if(M! =2) {cout<<S1[m]; } } } Else if(s1[mark+1] =='+'){ if(Value1 < Mark-3) { for(intL =1; L < Mark; l++){ if(L! =2){ ifL2==value1) {cout<< S1[l] <<"."; } Else{cout<<S1[l]; } } } } Else if(Value1 >= Mark-3) { for(n =1; n < Mark; n++){ if(n! =2) {cout<<S1[n]; } } for(M =0; M < value1 +3-Mark; m++) {cout<<0; } } } } if(s1[0] =='-'){ for(i =1; I < s1.length (); i++){ if(S1[i] = ='E') {Mark=i; Break; } } for(j = Mark +2; J < S1.length (); J + +) {Zhishu= Zhishu +S1[j]; } value2=atoi (Zhishu.c_str ()); if(s1[mark+1] =='-') {cout<<"-"<<0<<"."; value2--; while(value2) {cout<<0; value2--; } for(n =1; n < Mark; n++){ if(n! =2) {cout<<S1[n]; } } } Else if(s1[mark+1] =='+') {cout<<"-"; if(value2 >= Mark-3) { for(n =1; n < Mark; n++){ if(n! =2) {cout<<S1[n]; } } for(M =0; M < value2 +3-Mark; m++) {cout<<0; } } Else if(Value2 < Mark-3){ for(n =1; n < Mark; n++){ if(n! =2){ if(N-2==value2) {cout<< S1[n] <<"."; } Else{cout<<S1[n]; } } } } } } return 0;}
Capouis ' CODE
pat-basic-1024-Scientific Counting method