PAT(甲级)Scientific Notation (20)
来源:互联网 发布:朱棣 知乎 编辑:程序博客网 时间:2024/06/10 21:16
题目:https://www.patest.cn/contests/pat-a-practise/1073
代码:
#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>using namespace std;int main(){ char str[10010];gets(str);int len=strlen(str);if(str[0]== '-') printf("-");int pos=0;while(str[pos]!='E'){ pos++;}int exp=0;for(int i=pos+2;i<len;i++){ exp=exp*10+(str[i]-'0');}if(exp==0){for(int i=1;i<pos;i++){ printf("%c",str[i]);}}if(str[pos+1]=='-'){ printf("0.");for(int i=0;i<exp-1;i++){ printf("0");}printf("%c",str[1]);for(int i=3;i<pos;i++){ printf("%c",str[i]);}}else{for(int i=1;i<pos;i++){ if(str[i]=='.') continue; printf("%c",str[i]); if(i ==exp+2&&pos-3!=exp){ printf("."); }}for(int i=0;i<exp-(pos-3);i++){printf("0");}} system("pause");}
0 0
- PAT(甲级)Scientific Notation (20)
- PAT甲级练习1073. Scientific Notation (20)
- PAT甲级1073. Scientific Notation (20)
- 【PAT甲级】1073. Scientific Notation (20)
- PAT 甲级 1073. Scientific Notation (20)
- 1073. Scientific Notation (20)-PAT甲级真题
- PAT-A1073. 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. Scientific Notation (20)
- 【PAT】A1073. Scientific Notation (20)
- PAT A1073. Scientific Notation (20)
- 1024. 科学计数法 (20)PAT乙级&&1073. Scientific Notation (20)PAT甲级
- 洛谷 P2024 食物链
- gtest 测试实例间共享数据的方法
- 并发登录人数控制--Shiro系列(二)
- 33 个 2017 年必须了解的 iOS 开源库
- 插件化开发---Hook之动态代理方式
- PAT(甲级)Scientific Notation (20)
- pat-bl-1053
- hibernate的native sql查询
- android虚拟键盘弹出遮挡登陆按钮问题
- SOAP Webserver 与 Restful Webserver 区别
- 【HDU 6012 Lotus and Horticulture】+ 思维 + map
- eclipse导入远程git代码及(push、pull、及maven工程导入)
- ExecutorService 的理解与使用
- GRID downgrade.