Scientific notation is the way that 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 has exactly one digit, there is at least one digit in the fractional portion, and the number and its exponent's signs are always provided even when they are positive.

Now given a real number A in scientific notation, you are supposed to print A in the conventional notation while keeping all the significant figures.

Input Specification:

Each input contains one test case. For each case, there is one line containing the real number A in scientific notation. The number is no more than 9999 bytes in length and the exponent's absolute value is no more than 9999.

Output Specification:

For each test case, print in one line the input number A in the conventional notation, with all the significant figures kept, including trailing zeros.

Sample Input 1:

+1.23400E-03

Sample Output 1:

0.00123400

Sample Input 2:

-1.2E+10

Sample Output 2:

-12000000000
 #include <iostream>
#include <string>
using namespace std;
int main()
{
string str, f1, num1, num2, f2, num3, res = "";
cin >> str;
int nDot, E, Exp = ;
f1 = str[];
nDot = str.find('.');
num1 = str[nDot - ];//第一位数字
E = str.find('E');
num2.assign(str.begin() + nDot + , str.begin() + E);//小数点后面的数字
f2 = str[E + ];
num3.assign(str.begin() + E + , str.end());//指数
for (int i = ; i < num3.length(); ++i)//计算指数
Exp = Exp * + num3[i] - '';
if (f1 == "-")
res += "-";
if (f2 == "-")
{
res += "0.";
res.insert(res.end(), Exp - , '');//中间插入0
}
else if (f2 == "+")
{
if (num2.length() <= Exp)//小数位不足,则直接末尾加0;
num2.insert(num2.end(), Exp - num2.length(), '');
else//小数位多余幂次,则小数点后移
num2.insert(num2.begin() + Exp, , '.');
}
res += num1 + num2;
cout << res << endl;
return ;
}

PAT甲级——A1073 Scientific Notation的更多相关文章

  1. PAT 甲级 1073 Scientific Notation (20 分) (根据科学计数法写出数)

    1073 Scientific Notation (20 分)   Scientific notation is the way that scientists easily handle very ...

  2. PAT甲级——1073 Scientific Notation (20分)

    Scientific notation is the way that scientists easily handle very large numbers or very small number ...

  3. PAT A1073 Scientific Notation (20 分)——字符串转数字

    Scientific notation is the way that scientists easily handle very large numbers or very small number ...

  4. A1073. Scientific Notation

    Scientific notation is the way that scientists easily handle very large numbers or very small number ...

  5. PAT Advanced 1073 Scientific Notation (20 分)

    Scientific notation is the way that scientists easily handle very large numbers or very small number ...

  6. PAT_A1073#Scientific Notation

    Source: PAT A1073 Scientific Notation (20 分) Description: Scientific notation is the way that scient ...

  7. PAT 1073 Scientific Notation[字符串处理][科学记数法]

    1073 Scientific Notation(20 分) Scientific notation is the way that scientists easily handle very lar ...

  8. PAT 1073 Scientific Notation

    1073 Scientific Notation (20 分)   Scientific notation is the way that scientists easily handle very ...

  9. PAT Basic 1024 科学计数法 (20 分) Advanced 1073 Scientific Notation (20 分)

    科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式 [+-][1-9].[0-9]+E[+-][0-9]+,即数字的整数部分只有 1 位,小数部分至少有 1 位,该数字及其指 ...

随机推荐

  1. neo4j常用cypher语句

    阅读更多 1.删除带有关系的节点   a.先删除关系 match (n:Node)-[r:关系名称]-() where (n...条件) delete r   b.删除节点 match (n:Node ...

  2. 偏函数-functools.partial

    1.概念:偏函数是2.5版本以后引进来的东西.属于函数式编程的一部分,使用偏函数可以通过有效地“冻结”那些预先确定的参数,来缓存函数参数,然后在运行时,当获得需要的剩余参数后,可以将他们解冻,传递到最 ...

  3. 2018-10-8-Win10-使用-GHO-安装出现-UWP-软件打开闪退-应用商店无法安装软件

    title author date CreateTime categories Win10 使用 GHO 安装出现 UWP 软件打开闪退 应用商店无法安装软件 lindexi 2018-10-8 18 ...

  4. 2019-7-27-解决从旧格式的-csproj-迁移到新格式的-csproj-格式-AssemblyInfo-文件值重复问题...

    title author date CreateTime categories 解决从旧格式的 csproj 迁移到新格式的 csproj 格式 AssemblyInfo 文件值重复问题 lindex ...

  5. artTemplate(mark)

    一个渲染性能出众模板引擎,无论在 NodeJS 还是在浏览器中都可以运行. 特性 拥有接近 JavaScript 渲染极限的的性能 调试友好:语法.运行时错误日志精确到模板所在行:支持在模板文件上打断 ...

  6. 挂载U盘

    .fdisk -l 查看当前系统存储盘 (sdaX一般是系统自带, sdbX则是外接) .mount /dev/sdbX /mnt/usb/ (如果usb目录不存在可创建新目录) .umount /m ...

  7. Java导出pdf文件数据

    提示:导出pdf文件,需要3个jar包iText-2.1.5.jar,iTextAsian.jar,iText-rtf-2.1.4.jar. public boolean outputPdfJhsy( ...

  8. 最大流dicnic——hdu1532模板题

    #include<bits/stdc++.h> using namespace std; #define maxn 1005 #define ll long long const ll i ...

  9. Spring整合Dubbo框架

    Dubbo作为一个RPC框架,其最核心的功能就是要实现跨网络的远程调用.演示过程创建两个小工程,一个作为服务的提供者,一个作为服务的消费者.通过Dubbo来实现服务消费者远程调用服务提供者的方法. d ...

  10. Unity3D Input 键盘控制

    function Update (){ //Input.GetKey ("down") == Input.GetKey(KeyCode.DownArrow) if (Input.G ...