题意:

输入科学计数法输出它表示的数字。

AAAAAccepted code:

 #define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
string s;
int ans2[];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>s;
int n=s.size();
if(s[]=='-')
cout<<'-';
int pos=;
int cnt2=;
int ans=s[]-'';
for(int i=pos;i<n;++i){
if(s[i]=='E'){
pos=i+;
break;
}
ans2[++cnt2]=s[i]-'';
}
int flag=;
if(s[pos]=='-')
flag=;
++pos;
int num=;
for(int i=pos;i<n;++i){
num*=;
num+=s[i]-'';
}
if(flag){
cout<<<<'.';
for(int i=;i<num;++i)
cout<<;
cout<<ans;
for(int i=;i<=cnt2;++i)
cout<<ans2[i];
}
else{
int num2=;
cout<<ans;
int tamp=;
for(tamp=;tamp<=cnt2&&num2<num;++tamp,++num2)
cout<<ans2[tamp];
if(tamp>cnt2)
for(int i=;i<=num-num2;++i)
cout<<;
else{
cout<<'.';
for(int i=tamp;i<=cnt2;++i)
cout<<ans2[i];
}
}
return ;
}

【PAT甲级】1073 Scientific Notation (20 分)的更多相关文章

  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 Advanced 1073 Scientific Notation (20 分)

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

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

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

  5. PAT 甲级 1035 Password (20 分)

    1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...

  6. 1073. Scientific Notation (20)

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

  7. PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)

    1050 String Subtraction (20 分)   Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be t ...

  8. PAT 甲级 1046 Shortest Distance (20 分)(前缀和,想了一会儿)

    1046 Shortest Distance (20 分)   The task is really simple: given N exits on a highway which forms a ...

  9. PAT 甲级 1042 Shuffling Machine (20 分)(简单题)

    1042 Shuffling Machine (20 分)   Shuffling is a procedure used to randomize a deck of playing cards. ...

随机推荐

  1. oracle 处理锁表,创建新的数据库实例

    select saddr,sid,serial#,paddr,username,status from v$session where username is not null and usernam ...

  2. altair package and altair_viewer

    pip install altair pip install altair_viewer Altair is a declarative statistical visualization libra ...

  3. DTU DeepLearning: exercise 7

    torch activation functions: sigmoid, relu, tanh, softplus. https://morvanzhou.github.io/tutorials/ma ...

  4. MyEclipse 安装 emmet 插件

    1.在线安装 地址:http://download.emmet.io/eclipse/updates/ 安装完成后重新启动myeclipse 2.离线安装 下载jar包:https://github. ...

  5. 第五篇,理解JS模块化编程思想

    模块化编程 ·模块化编程是一种处理复杂系统分解成更好的可管理模块的方式,它可以把系统代码划分为职责单一高度解耦切可替代的模块. ·系统中某一部分的变化将如何影响其他部分就会变得显而易见,系统的可维护性 ...

  6. IntelliJ IDEA 2017.3尚硅谷-----模板

    https://www.jetbrains.com/help/idea/using-live-templates.html  

  7. Jquery动态改变my97datepicker的日期形式

    先要解绑触发事件: $('#start').unbind('focus'); 然后再绑定触发事件: $('#start').bind('focus',function(){WdatePicker({s ...

  8. python之路之考试题目

  9. 第三十三篇 玩转数据结构——红黑树(Read Black Tree)

    1.. 图解2-3树维持绝对平衡的原理: 2.. 红黑树与2-3树是等价的 3.. 红黑树的特点 简要概括如下: 所有节点非黑即红:根节点为黑:NULL节点为黑:红节点孩子为黑:黑平衡 4.. 实现红 ...

  10. hdu1874 (spfa 最短路)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874 很简单的最短路问题,刚刚学习spfa,其实很简单,思想和一维动态规划差不多,数组d[i]表示起点 ...