题意:

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

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. vue-element-admin框架快速入门

    年底了,最近公司也不是太忙,感觉今年互联网行业都遇到寒冬,不在是前两年像热的发烫的赛道.这几天完成公司项目系统的优化和升级,目前准备想开发一套前后端分离的系统.       现在java最新最火的技术 ...

  2. java基础之 数据类型

    数据类型表示要存储在变量中的不同类型的值. 一.Java语言提供了八种基本数据类型.六种数字类型(四个整数型,两个浮点型),一种字符类型,还有一种布尔型. 1. byte byte 数据类型是8位.有 ...

  3. [NOIP2017(TG/PJ)] 真题选做

    [NOIPTG2017] 小凯的疑惑 题意 小凯有两种面值的金币,每种金币有无数个,求在无法准确支付的物品中,最贵的价值是多少金币. 分析 设两种金币面值分别为 $a$ 和 $b \; (a<b ...

  4. mongo gridfs 学习

    一.mongo是啥东西? MongoDB 是由C++语言编写的,基于分布式文件存储的开源数据库系统.在高负载的情况下,添加更多的节点,可以保证服务器性能. 二.gridfs是啥东西? 1.MongoD ...

  5. 【游戏体验】I Paid For It!(火柴人破坏狂)

    >>>点此处可试玩无敌版<<< 注意,本游戏含有少量暴力元素,13岁以下的儿童切勿尝试本款游戏 这款游戏打击感非常高,动画也比较绚丽,可玩性很高 个人测评 游戏性 ...

  6. 用js实现鼠标点击爱心特效

    效果如图以下是代码 <script> !function(e, t, a) { function r() { for (var e = 0; e < s.length; e++) s ...

  7. Shell脚本命令汇总中

    一.换行 echo -e 可以通过\n编译换行 echo -n不换行,如果加入了\n,则会打出“\n”字符 #!/bin/bash echo -e "O\nK\n!" echo & ...

  8. 【做题笔记】P1969 积木大赛

    非常感谢 rxz 大佬提供的思路. 首先放个图(rxz 画的) 采用贪心的策略:对于一个期望高度 \(h_i\) ,如果大于 \(h_{i-1}\),那么最终答案要加上二者之差:如果小于或等于,那么说 ...

  9. Tomcat目录说明

    apache-tomcat-x.x.xx bin:保存启动与监控Tomcat的命令文件的文件夹 conf:保存Tomcat配置文件的文件夹,如servlet.xml为服务器的主配置文件,web.xml ...

  10. opencv:联通组件扫描

    #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...