1073. Scientific Notation (20)
Scientific notation is the the-the-by-scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9] "." [0-9]+e[+-][0-9]+ which means that the integer portion have exactly one digit, there is at least one digit in the Fractiona L portion, and the number and its exponent ' s signs is always provided even when they is positive.
Now given a real number a in scientific notation, you is supposed to print a in the conventional notation while keeping a ll the significant figures.
Input Specification:
Each input file contains the one test case. There is one line containing the real number A in scientific notation. The number is no further than 9999 bytes in length and the exponent ' s absolute value are no more than 9999.
Output Specification:
For each test case, print on one line the input number A in the conventional notation, with all the significant figures ke PT, including trailing zeros,
Sample Input 1:
+1.23400E-03
Sample Output 1:
0.00123400
Sample Input 2:
-1.2E+10
Sample Output 2:
-12000000000
1#include <iostream>2#include <string>3 4 using namespacestd;5 6 intMain ()7 {8 strings;9CIN >>s;Ten One if(s[0] =='-') Acout << s[0]; - inti =1; - stringnum; the while(S[i]! ='E'&&i<s.size ()) - { - if(S[i]! ='.') - Num.insert (Num.end (), s[i]); +i++; - } +i++; A intFlag =1, radix =0; at if(s[i++] = ='-') -Flag =-1; - while(I <s.size ()) - { -Radix = Radix *Ten+ S[i]-'0'; -i++; in } - to intPointIndex =1+ flag*Radix; + if(PointIndex <=0) -cout <<"0."<<string(-pointindex,'0') <<num; the Else if(PointIndex >=num.size ()) *cout << Num <<string(Pointindex-num.size (),'0'); $ ElsePanax Notoginseng { - for(inti =0; I < num.size (); i++) the { + if(i = =PointIndex) Acout <<"."; thecout <<Num[i]; + } - } $}
PAT 1073. Scientific Notation (20)