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. typescript interface 泛型

    interface interface Obj { [index: string]: any; } class Person { name: string; } let obj: obj = { na ...

  2. 对String中固定符号隔开的每项做无序不重复监测

    Response<List<String[]>> response = new Response<>(); // 引擎方式校验 // 在此对知识内容标签进行打标 t ...

  3. 问题: 揭秘Angualr2 书上问卷调查

    npm install 初夏下面问题: 0 info it worked if it ends with ok1 verbose cli [ '/home/linux_ubuntu164/tools/ ...

  4. day07 Python文件操作

    一,文件操作基本流程 #1. 打开文件,得到文件句柄并赋值给一个变量 f=open('a.txt','r',encoding='utf-8') #默认打开模式就为r #2. 通过句柄对文件进行操作 d ...

  5. 游戏服务器之Java热更新

    对于运行良好的游戏来说,停服一分就会损失很多收益.因为有些小bug就停服就划不来了.在使用Java开游戏服务器时,JVM给我们提供了一些接口,可以简单做一些热更新.修复一些小Bug而不用重启服务. J ...

  6. spring boot + vue + element-ui全栈开发入门——主页面开发

    目的 开发一个后台管理的前端,顶部是标题,左侧是菜单导航栏,中间是要显示的内容.而内容可以是各种图表,也可以是数据列表. 一.准备工作 1..修改App.vue文件 代码如下: <templat ...

  7. 知识在与温故、总结-再读CLR

    序 CLR,通用语言运行时,每个.Net 程序猿,都会第一时间接触到.记得2008年,第一次学习Jeffrey Richter的CLR Via C#,读的懵懵懂懂,大抵因为编码太少,理解的只是概念和皮 ...

  8. 转:在 C# 中使用 P/Invoke 调用 Mupdf 函数库显示 PDF 文档

    在 C# 中使用 P/Invoke 调用 Mupdf 函数库显示 PDF 文档 一直以来,我都想为 PDF 补丁丁添加一个 PDF 渲染引擎.可是,目前并没有可以在 .NET 框架上运行的免费 PDF ...

  9. 用Java画简单验证码

    以下是具体代码: package com.jinzhi.tes2; import java.awt.Color;import java.awt.Font;import java.awt.Graphic ...

  10. Html table、thead、tr、th、td 标签

    Html table.thead.tr.th.td 标签 案例一 <!-- table 表格标签,配置表格使用.border="1" 添加表格框架 --> <ta ...