PAT (Advanced Level) 1073. Scientific Notation (20)
简单模拟题。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std; char s[];
int p; int main()
{
scanf("%s",s);
for(int i=;s[i];i++) if(s[i]=='E') p=i; if(s[]=='-') printf("%c",s[]); int num=;
for(int i=p+;s[i];i++) num=num*+s[i]-''; if(s[p+]=='-')
{
printf("0.");
for(int i=;i<num-;i++) printf("");
for(int i=;s[i];i++)
{
if(s[i]=='E') break;
if(s[i]=='.') continue;
else printf("%c",s[i]);
}
} else
{
int d;
for(int i=;s[i];i++)
{
if(s[i]=='.') d=i;
}
if(p-d->num)
{
if(s[]!='') printf("%c",s[]);
for(int i=;i<+num;i++) printf("%c",s[i]);
printf(".");
for(int i=+num;s[i];i++)
{
if(s[i]=='E') break;
printf("%c",s[i]);
}
}
else
{
for(int i=;s[i];i++)
{
if(s[i]=='E') break;
if(s[i]=='.') continue;
if(i==&&s[i]=='') continue;
printf("%c",s[i]);
}
for(int i=;i<num-(p-d-);i++) printf("");
}
}
return ;
}
PAT (Advanced Level) 1073. Scientific Notation (20)的更多相关文章
- 【PAT甲级】1073 Scientific Notation (20 分)
题意: 输入科学计数法输出它表示的数字. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> u ...
- PAT 甲级 1073 Scientific Notation (20 分) (根据科学计数法写出数)
1073 Scientific Notation (20 分) Scientific notation is the way that scientists easily handle very ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642
PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...
- PAT Advanced 1073 Scientific Notation (20 分)
Scientific notation is the way that scientists easily handle very large numbers or very small number ...
- PAT Basic 1024 科学计数法 (20 分) Advanced 1073 Scientific Notation (20 分)
科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式 [+-][1-9].[0-9]+E[+-][0-9]+,即数字的整数部分只有 1 位,小数部分至少有 1 位,该数字及其指 ...
- PAT甲级——1073 Scientific Notation (20分)
Scientific notation is the way that scientists easily handle very large numbers or very small number ...
- 1073. Scientific Notation (20)
题目如下: Scientific notation is the way that scientists easily handle very large numbers or very small ...
- PAT甲题题解-1073. Scientific Notation (20)-字符串处理
题意:给出科学计数法的格式的数字A,要求输出普通数字表示法,所有有效位都被保留,包括末尾的0. 分两种情况,一种E+,一种E-.具体情况具体分析╮(╯_╰)╭ #include <iostrea ...
随机推荐
- 第二十节,基本数据类型,集合set、综合应用新数据更新老数据
基本数据类型,集合set.综合应用新数据更新老数据 创建两个字典新数据,更新原始数据,a为原始数据,b为新数据 1,分别获取到a字典和b字典的key(键),将两个字典的键分别转换成两个集合 2,找出a ...
- java FLOAT
System.out.println(""+ 1/2); 得不到0.5,只能得到0. 要想打印出浮点数,必须除数和被除数至少有一个是浮点数,像这样: System.out.prin ...
- diff and patch
A patch captures the changes of two different files (oldfile and newfile). Given the oldfile and the ...
- 数据库sql语句为什么要用绑定形式?
基于两点: 1,安全性,防sql注入: 2,共享资源,相似的sql能被缓存而不是重新解析. 淘测试给出了一个很好的理由:http://www.taobaotesting.com/blogs/859
- oracle即时客户端安装方法
http://blog.csdn.net/magicboylinw/article/details/7025885 Oracle Instant Client(即时客户端) 安装与配置 oracleO ...
- android之DPAD上下左右四个键控制
我们代码的目的很简单,那就是监听上下左右中这几个键的事件触发.直接上代码: dpad.xml <?xml version="1.0" encoding="utf-8 ...
- log4j2.xml配置及例子
1.使用log4j2需要下载包,如下: 2.配置文件可以有三种格式(文件名必须规范,否则系统无法找到配置文件): classpath下名为 log4j-test.json 或者log4j-test.j ...
- layer属性
键: 值 描述 下表的属性都是默认值,您可在调用时按需重新配置,他们可帮助你实现各式各样的风格.如是调用: $.layer({键: 值, 键: 值, -}); type: 0 层的类型.0:信息框(默 ...
- Arrays类与Array类探究
这里所说的Arrays类是util包中的java.util.Arrays,Array是反射包中的java.lang.reflect.Array. 首先介绍Arrays类的常用的静态方法: 1.排序方法 ...
- js 关键字 in
对于数组 ,迭代出来的是数组元 素,对于对象 ,迭代出来的是对象的属性: var x var mycars = new Array() mycars[0] = "Saab" myc ...