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 ...
随机推荐
- 解析好的静态页面.shtml浏览器无法解析.需要apache解析后再返回给浏览器
解析好的静态页面.shtml浏览器无法解析.需要apache解析后再返回给浏览器 让Apache支持SHTML(SSI)的配置方法 http.conf放开addtype text/html .shtm ...
- LeetCode OJ 96. Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For examp ...
- how to use the curses library in unix?
In linux, you can use the ncurses library to use the terminal as a text buffer: move the cursor arou ...
- android 瀑布流效果(仿蘑菇街)
我们还是来看一款示例:(蘑菇街) 看起来很像我们的gridview吧,不过又不像,因为item大小不固定的,看起来是不是别有一番风味,确实如此.就如我们的方角图形,斯通见惯后也就出 ...
- App Store 升级问题
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launc ...
- linux安装tomcat, jdk出现的问题
1)卸载系统自带的jdk版本: 查看自带的jdk: #rpm -qa|grep gcj 可能看到如下类似的信息: libgcj-4.1.2-44.el5 jav ...
- PCI源码学习笔记
这个是PCI的关键结构体. static const struct file_operations proc_bus_pci_operations = { .owner = THIS_MODULE, ...
- Java学习笔记之I/O
package com.chinasofti.javase20160819; import java.io.BufferedReader; import java.io.BufferedWriter; ...
- SpringMVC redirect乱码问题
转:http://blog.csdn.net/xubo_zhang/article/details/8239725 spring redirect 用spring redirect中文会乱码:如下示例 ...
- string.IsNullOrWhiteSpace
string.IsNullOrWhiteSpace(str) 这个是判断所有空白字符,功能相当于string.IsNullOrEmpty和str.Trim().Length总和,他将字符串给Char. ...