1024. 科学计数法 (20)PAT乙级&&1073. Scientific Notation (20)PAT甲级
来源:互联网 发布:黄金实时报价软件 编辑:程序博客网 时间:2024/05/29 15:38
甲级传送门
乙级传送门
#include<stdio.h>#include<string.h>#define MAX_N 10010char str[MAX_N];int main(){ gets(str); int l=strlen(str); if(str[0]=='-') printf("-"); int position=0; while(str[position]!='E'){ position++; } int exp=0; for(int i=position+2;i<l;i++){ exp=exp*10+str[i]-'0'; //printf("%d\n",exp); } if(str[position+1]=='-'){ printf("0."); for(int i=0;i<exp-1;i++){ printf("0"); } for(int i=1;i<position;i++){ if(str[i]!='.') printf("%c",str[i]); } }else{ for(int i=1;i<position;i++){ if(str[i]!='.'){ printf("%c",str[i]); } if(i==exp+2&&position-3!=exp){ printf("."); } } for(int i=0;i<exp-(position-3);i++){ //printf("%d\n",exp-(position-3)); printf("0"); } }}
0 0
- 1024. 科学计数法 (20)PAT乙级&&1073. Scientific Notation (20)PAT甲级
- PAT (Advanced Level) 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 (科学计数法 字符串模拟)
- PAT-B 1024. 科学计数法(同PAT 1073. Scientific Notation)
- PAT-乙级-1024. 科学计数法 (20)
- PAT乙级.1024. 科学计数法 (20)
- PAT乙级 1024. 科学计数法 (20)
- PAT 乙级 1024. 科学计数法 (20)
- PAT 乙级 1024. 科学计数法 (20)
- PAT乙级 1024. 科学计数法 (20)
- PAT乙级1024. 科学计数法 (20)
- [PAT乙级]1024. 科学计数法 (20)
- PAT乙级1024. 科学计数法 (20)
- jQuery ajax跨域请求的解决方法
- java acm 题目8 一种排序 详细解析
- Java----File类详解
- 事务详解
- 进程间通信的几种方式
- 1024. 科学计数法 (20)PAT乙级&&1073. Scientific Notation (20)PAT甲级
- Material Design(3)(图特多)
- [HDU1556] Color the ball - 树状数组
- 类加载机制 读笔
- 36.activity返回携带数据
- maven项目 出现Specified web-root folder does not exist 的错误。
- 性能优化之list的size
- Android camera总回顾
- PAT A1082. Read Number in Chinese (25/21)