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

分析:字符串处理题,按题意改就行了。代码改了好多次。。。可能只有我自己能看懂了吧。。20分的题debug了半小时。。。
 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-24-16.27.04
 * Description : A1073
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;

 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     string s,ans="";
     cin>>s;
     ]=='-'){
         printf("-");
     }
     s.erase(s.begin());
     int i,len=s.length(),k,p;
     ;i<len;i++){
         '){
             ans+=s[i];
         }
         else if(s[i]=='.'){
             k=i; //记录小数点位置
             continue;
         }
         else if(s[i]=='E') {
             p=i;  //记录E的位置
             break;
         }
     }
     bool flag=true;
     ]=='-') flag=false;
     s.erase(i,); //删除E和指数符号
     string e="";
     ;i++){
         e=e+s[i];
     }
     int E=stoi(e);
     if(flag==false){
         printf("0.");
         ;j<E-;j++){
             printf(");
         }
         cout<<ans;
     }
     if(flag==true){
         ==E){
             cout<<ans;
         }
         <E){
             cout<<ans;
             ;j<E-;j++){
                 printf(");
             }
         }
         else{
             )-E+,m;
             ;m<a;m++){
                 printf("%c",ans[m]);
             }
             printf(".");
             for(;m<ans.size();m++){
                 printf("%c",ans[m]);
             }
         }
     }
     ;
 }


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

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

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

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

  4. PAT甲级——1073 Scientific Notation (20分)

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

  5. 【PAT甲级】1073 Scientific Notation (20 分)

    题意: 输入科学计数法输出它表示的数字. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> u ...

  6. 1073. Scientific Notation (20)

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

  7. PAT甲题题解-1073. Scientific Notation (20)-字符串处理

    题意:给出科学计数法的格式的数字A,要求输出普通数字表示法,所有有效位都被保留,包括末尾的0. 分两种情况,一种E+,一种E-.具体情况具体分析╮(╯_╰)╭ #include <iostrea ...

  8. PAT (Advanced Level) 1073. Scientific Notation (20)

    简单模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...

  9. PAT 1073 Scientific Notation

    1073 Scientific Notation (20 分)   Scientific notation is the way that scientists easily handle very ...

随机推荐

  1. Flappy Bird背后的故事

    更多有价值的互联网文章:晓煦分享(http://www.ihuxu.com/share) 由越南游戏工程师阮哈东(Nguyen Ha Dong)开发的Flappy Bird这款游戏,画面不算精致且看起 ...

  2. the usage of String

    经典算法:(整理汇总) 1)如何快速倒叙: public static char[] reverseArray(char[] c){ char t; for(int i=0;i<c.length ...

  3. C++语言的一些问题

    论坛上看到的有人提出的关于C++的一些问题,真是细致(下面还有回复说他对C++一知半解的),一直以为自己的C++还是可以的,可是看了之后真是内牛满面,为什么自己从来没有想的这么深入,差距真的有这么大吗 ...

  4. 应用“PUSH推送”的5个真相和5个误区

      真相一:用户厌烦的并不是推送功能本身 针对如何看待推送功能这一问题,对1万名用户进行了问卷调查,结果表明80%的用户表示不会拒绝推送功能.各个年龄段方面没有太大的差别,但女性用户更容易受个人兴趣和 ...

  5. ListBox item Sort

    将Rss内容读取到Listbox control中, 然后实现按照标题或发布日期进行排序. private void ListItemSort(string type) { if (type == & ...

  6. 当ORACLE归档日志满后如何正确删除归档日志

    当ORACLE 归档日志满了后,将无法正常登入ORACLE,需要删除一部分归档日志才能正常登入ORACLE. 一.首先删除归档日志物理文件,归档日志一般都是位于archive目录下,AIX系统下文件格 ...

  7. 将Mat类型坐标数据生成pts文件

    前言 获取人脸特征点的坐标信息之后,想要将坐标信息shape保存为pts/asf/txt等文件格式,本文就对此进行实现. 实现过程 1.确定pts文件的书写格式: 以要生成的文件为例,书写格式如下: ...

  8. AHK教程 - imsoft.cnblogs

    转自:小弗兰茨 AHK,就是传说中的 Auto Hot Key .什么?没有听说过?那么很正常……它运行在Windows下.总之,AHK可以赋予你对你的电脑的无与伦比的控制力.一些人想要在MM面前展示 ...

  9. CodeForces - 1097D:Makoto and a Blackboard (积性)

    Makoto has a big blackboard with a positive integer n written on it. He will perform the following a ...

  10. Linux下rsync命令使用总结

    一.rsync的概述 rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync.rsync是Linux系统下的文件同步和数据传输工具,它采用“rsync” ...