1073 Scientific Notation (20 分)
 

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<bits/stdc++.h>
using namespace std;
typedef long long ll; int to_int(string s){
int sum=;
for(int i=;i < s.size();i++){
sum = sum*+(s[i]-'');
}
return sum;
} int main(){
string s;cin >> s;
if(s[] == '-')cout << "-";
s = s.substr(,s.size()-); int pose = ;
for(int i=;i < s.size();i++){
if(s[i] == 'E')pose=i;
}
string s1 = s.substr(,pose);
string s2 = s.substr(pose+,s.size()-pose-);
// cout << s1 << " " << s2 <<endl;
// cout << to_int(s2);
int cnt = to_int(s2); string temp="";
for(int i=;i<s1.size();i++){
if(s1[i]!='.')temp = temp+s1[i];
}
// cout << temp;
if(s[pose+] == '-'){
string head = "0.";
for(int i=;i < cnt-;i++) head = head+"";
head = head + temp;
cout << head;
}
else if(s[pose+] == '+'){
if(temp.size() > cnt){
for(int i=;i <= cnt;i++)cout << temp[i];
if(cnt != temp.size()-)cout << ".";
for(int i=cnt+;i < temp.size();i++)cout << temp[i];
}
else{
cout << temp;
for(int i=;i <= cnt-temp.size();i++)cout << "";
}
} return ;
}

_1AC

 

PAT 1073 Scientific Notation的更多相关文章

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

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

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

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

  3. 1073 Scientific Notation (20 分)

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

  4. PAT Advanced 1073 Scientific Notation (20 分)

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

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

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

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

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

  7. 1073. Scientific Notation (20)

    题目如下: Scientific notation is the way that scientists easily handle very large numbers or very small ...

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

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

  9. PAT (Advanced Level) 1073. Scientific Notation (20)

    简单模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...

随机推荐

  1. springMVC(五): 通过 HandlerMapping 获取 HandlerExecutionChain

    请求具体过程 一.HandlerMapping Interface to be implemented by objects that define a mapping between request ...

  2. 18.1-uC/OS-III等待多个内核对象

    等待的多个内核对象是指多值信号量和消息队列的任意组合 . 如果想要使用“等待多个内核对象”,就必须事先使能“等待多个内核对象”.“等待多个内核对象” 的使能位于“os_cfg.h”. 1.OSPend ...

  3. Lint found fatal errors while assembling a release target

    1.Android 打包错误信息 Generate signed Bundle or APK  打包时,报了一个错,错误信息如下: Error:Execution failed for task ´: ...

  4. IIS下载无后缀文件的设置

    HTTP 错误 404.3 - Not Found由于扩展配置问题而无法提供您请求的页面.如果该页面是脚本,请添加处理程序.如果应下载文件,请添加 MIME 映射.   解决方法:MIME类型加 .  ...

  5. linux挂载概念简述:

    挂载概念简述: 根文件系统之外的其他文件要想能够被访问,都必须通过“关联”至根文件系统上的某个目录来实现,此关联操作即为“挂载”,此目录即为“挂载点”,解除此关联关系的过程称之为“卸载” 1.挂载:根 ...

  6. oracle中实现某个用户truncate 其它用户下的表

    oracle文档中对truncate权限的要求是需要某表在当前登录的用户下,或者当前登录的用户有drop any table的权限. 但是如果不满足第一个条件的情况下,要让某用户满足第二个条件就导致权 ...

  7. CentOS 7 yum安装zabbix 设置中文界面

    1.  配置安装前环境 2.  安装zabbix 3.  设置中文环境 准备搭建环境 : 系统:CentOS7.5 首先关闭SElinux 和防火墙 安装MariaDB数据库 [root@DaMoWa ...

  8. php年会抽奖

    <?php/** * 抽奖 * @param int $total */function getReward($total=1000){ $win1 = floor((0.12*$total)/ ...

  9. Delphi中的消息 (转载)

    消息是Windows发出的一个通知,它告诉应用程序某个事件发生了.在Delphi中,大多数情况下Windows的消息被封装在VCL的事件中,我们只需处理相应的VCL事件就可以了,但如果我们需要编写自己 ...

  10. sitecore开发入门之Sitecore字典结构最佳实践

    使用Sitecore时,一个重要的主题是如何为您的网站处理不同的语言和区域.Sitecore对此的回答是使用字典项,它基本上只代表键/值定义.但是,这个字典项可以设置为具有不同的语言版本,这几乎允许您 ...