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 ...
随机推荐
- jsp的九大天王
JSP中一共预先定义了9个这样的对象,分别为:request.response.session.application.out.pagecontext.config.page.exception 1. ...
- HDU2504:又见GCD
Problem Description 有三个正整数a,b,c(0<a,b,c<10^6),其中c不等于b.若a和c的最大公约数为b,现已知a和b,求满足条件的最小的c. Input ...
- 【实验室笔记】太阳能板清洁器DEMO
<太阳能板清洁器DEMO>2015年的毕昇杯比赛作品,用时两天,整体设计思路很简单: [机械结构]: 清洁器主体采用角钢搭建,用钢锯切割好以后,上螺丝,走线用的尼龙扎带捆绑: 清洗滚轮采用 ...
- js里写网页结构, 传函数参数
如题 "<td align='center' height='30px' width='80px'><a href='javascript:sort(\"&quo ...
- 19个心得 明明白白说Linux下的负载均衡
[51CTO.com独家特稿]前言:作为一名Linux/unix系统工程师,这几年一直在涉及到对外项目,经手过许多小中型网站的架构,F5.LVS及Nginx接触的都比较多,我想一种比较通俗易懂的语气跟 ...
- c++判断一个字符串是否是数字
bool isNum(const string& str) { bool bRet = false; bool point = false; ) { return bRet; } ]) &am ...
- coco2d-x CCDirector.h文件中变量*m_pNotificationNode*
1.在CCDiretor.h中有如下说明 /** This object will be visited after the main scene is visited. This object MU ...
- [转]Android之Context和Activity互相转换
1.context转换为activity Activity activity = (Activity) context; 2.从activity得到context 在activity的方法中用cont ...
- 80x86的3种工作方式
80x86中的32位CPU全面支持32位的数据.指令和寻址方式,提供了3种工作方式:是地址方式.保护方式和保护方式下的虚拟8086方式.在计算机上电或复位后,32位CPU首先初始化为是地址方式,再通过 ...
- java synchronized内置锁的可重入性和分析总结
最近在读<<Java并发编程实践>>,在第二章中线程安全中降到线程锁的重进入(Reentrancy) 当一个线程请求其它的线程已经占有的锁时,请求线程将被阻塞.然而内部锁是可重 ...