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
Idea: Drawing flowcharts helps to understand
1#include <stdio.h>2 Charstr[10010];3 intMainintargcChar**argv) {4scanf"%s", str);5 BOOLflag1=true, flag2=true;6 if(str[0]=='-')7flag1=false;8 inti;9 for(i=0; str[i]!='E'; i++)Ten ; One if(str[++i]=='-') A { -Flag2=false; - } the intMove=0; - for(i=i+1; str[i]!=' /'; i++) - { - inttemp=str[i]- -; +move=move*Ten+temp; - } + if(!Flag1) Aprintf"-"); at if(!Flag2) - { - if(move!=0) - { -move--; -printf"0."); in } - while(move--) toprintf"0"); + for(i=0; str[i]!=' /'; i++) - { the if(str[i]=='E') * Break; $ if(str[i]=='+'|| str[i]=='-'|| str[i]=='.')Panax Notoginseng Continue; -printf"%c", Str[i]); the } + } A Else the { +printf"%c", str[1]); -I=3; $ while(move--) $ { - - if(str[i]!='E') theprintf"%c", str[i++]); - ElseWuyi { theprintf"0"); - } Wu } - //Processing of points About if(str[i]!='E') $printf"."); - while(str[i]!='E') - { -printf"%c", str[i++]); A } + } the - $ return 0; the}
View Code
PAT1024 Scientific Counting Act (20)