【PAT】1073. Scientific Notation
来源:互联网 发布:java递归代码 编辑:程序博客网 时间:2024/05/16 08:35
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main(){ char str[10010]; gets(str); char ans[10010]; int len=strlen(str); if(str[0]=='-') cout<<'-'; ans[0]=str[1]; char exp[10];int i; for(i=3;i<len && str[i]!='E';i++){ ans[i-2]=str[i]; } ans[i-2]='\0'; int k=0; for(i++;i<len;i++) exp[k++]=str[i]; int ep=0; int l=strlen(exp); for(int i=1;i<l;i++){ ep*=10; ep+=exp[i]-'0'; } int len1=strlen(ans); if(exp[0]=='-'){ printf("0."); for(int i=0;i<ep-1;i++) printf("0"); printf("%s",ans); }else{ if(len1-2>=ep) { for(int i=0;i<=ep;i++) printf("%c",ans[i]); printf("."); for(int i=ep+1;i<len1;i++) printf("%c",ans[i]); } else{ printf("%s",ans); for(int i=0;i<ep-len1+1;i++) printf("0"); } } return 0;}
0 0
- PAT 1073. Scientific Notation
- PAT 1073. Scientific Notation
- 【PAT】1073. Scientific Notation
- pat 1073. Scientific Notation
- PAT 1073. Scientific Notation (20)
- PAT 1073. Scientific Notation (20)
- PAT 1073. Scientific Notation (20)
- PAT 1073. Scientific Notation (20)
- PAT 1073. Scientific Notation(20)
- PAT 1073. Scientific Notation (20)
- PAT 1073. Scientific Notation (20)
- 【PAT】1073. Scientific Notation (20)
- Pat 1073 PAT 1073. Scientific Notation (20)
- PAT (Advanced) 1073. Scientific Notation (20)
- PAT-1073. Scientific Notation(Java StringBuild)
- PAT Advanced Level 1073. Scientific Notation (20)
- PAT A 1073. Scientific Notation (20)
- PAT甲级练习1073. Scientific Notation (20)
- (c++)求一个3×3矩阵对角线元素之和。
- NS3入门学习(一)之脚本运行实例
- pod 导入第三方库后,使用import 不提示第三方库头文件
- 针对于Activiti工作流引擎初学者的一些总结
- 8VC Venture Cup 2017 - Elimination Round(A+B)
- 【PAT】1073. Scientific Notation
- 分析函数
- 计算机原理学习(5)-- x86-16 CPU和内存管理
- elasticsearch5.0.1安装 marvel 插件
- 炸飞我了的线段树练习题
- hive transform脚本书写问题
- 性能测试结果分析
- angularjs之间如何实现指令和指令之间的交互
- android.support.design.widget.TabLayout的使用