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 ...
随机推荐
- 句柄C++
C++中的句柄 这个句柄只是从英文handle翻译过来的,只问句是什么意思难以解释,这个是我从别人的空间收集的信息, 功能上的理解: 什么是"句柄"(handle),handle的 ...
- wamp服务器
wamp2.5会出现的问题,是因为WampServer2.5内置的是PHP5.5,而PHP5.5 环境是基于VC11的编译脚本下生成的,所以需要安装Visual Studio 2012 VC 11 v ...
- IOS 播放视频 MPMoviePlayerController
在unity游戏的开头播放视频 , 根据需求 , 最后决定用 MPMoviePlayerController 来实现播放, 实现如下: by Tin 需要在AppController.mm的 Open ...
- 我的 Github 个人博客是怎样炼成的
Joey's Blog 长大后才发现政府建造 GFW 真是太 TM 机智了,由于本人自制力较差,且不说 91porn, youporn 等两性知识网站的超强战斗力,单单一个Youtube就可以让我瞬间 ...
- VMware设置NAT网络
很多初学者迷茫与如何实现虚拟机VMware与主机互联,这里小编介绍下简单实用的NAT网络. 工具/原料 VMware 方法/步骤 打开VMware,选择 编辑, 虚拟网络编辑器 默认情况下, ...
- Inno Setup入门(九)——修改安装过程中的文字显示
前面说到过可以使用不用的语言文件实现不同的显示方式,方便与国际接轨,事实上即使没有语言文件也可以实现修改.[Messages]段用于定义安装程序和卸载程序中显示的消息.一般不需要创建 [Message ...
- Sql Server异常捕获 try catch
declare @num int begin try end try begin catch select ERROR_LINE() as 错误行数, ERROR_MESSAGE() as 错误消息 ...
- make 命令执行时,报错“missing separator stop”
在Makefile文件中,命令必须以[tab]键开始.
- PHP 实现定时任务的几种方法
一. 简单直接不顾后果型 <?php ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行. set_time_limit(0);// 通过set_time_limi ...
- OC 消息机制本质
转载自:http://m.blog.csdn.net/blog/util_c/10287909 在Objective-C中,message与方法的真正实现是在执行阶段绑定的,而非编译阶段.编译器会将消 ...