C. Exponential notation
time limit per test:

2 seconds

memory limit per test:256 megabytes
input:

standard input

output:

standard output

You are given a positive decimal number x.

Your task is to convert it to the "simple exponential notation".

Let x = a·10b, where 1 ≤ a < 10, then in general case the "simple exponential notation" looks like "aEb". If b equals to zero, the part "Eb" should be skipped. If a is an integer, it should be written without decimal point. Also there should not be extra zeroes in aand b.

Input

The only line contains the positive decimal number x. The length of the line will not exceed 106. Note that you are given too large number, so you can't use standard built-in data types "float", "double" and other.

Output

Print the only line — the "simple exponential notation" of the given number x.

Examples
input
16
output
1.6E1
input
01.23400
output
1.234
input
.100
output
1E-1
input
100.
output
1E2

题目链接:http://codeforces.com/problemset/problem/691/C

题意:就是把一个数转换成a*10^b(1≤a﹤10)形式,输出aEb。
思路:标记第一个不为零的数的位置作为起点s,标记最后一个不为零的数的位置作为终点e,标记小数点的位置sign,默认位置应该为len+1。根据三个位置进行输出。

代码:
#include<bits/stdc++.h>
using namespace std;
char x[];
int main()
{
int i;
scanf("%s",x);
int len=strlen(x);
int s=-,e=len-,sign=len;
for(i=; i<len; i++)
if(x[i]=='.')
{
sign=i;
break;
}
for(i=; i<len; i++)
if(x[i]>''&&x[i]<='')
{
s=i;
break;
}
for(i=len-; i>=; i--)
if(x[i]>''&&x[i]<='')
{
e=i;
break;
}
if(s>=)
{
cout<<x[s];
if(e>s) cout<<".";
for(i=s+; i<=e; i++)
if(x[i]!='.') cout<<x[i];
if((s+)!=sign)
{
cout<<"E";
if(s<sign) cout<<sign-s-<<endl;
else if(s>sign) cout<<sign-s<<endl;
}
}
else cout<<""<<endl;
return ;
}


 

Codeforces 691C. Exponential notation 模拟题的更多相关文章

  1. 【模拟】Codeforces 691C Exponential notation

    题目链接: http://codeforces.com/problemset/problem/691/C 题目大意: 输入一个数,把它表示成a·10b形式(aEb).输出aEb,1<=a< ...

  2. Codeforces 691C. Exponential notation

    题目链接:http://codeforces.com/problemset/problem/691/C 题意: 给你一个浮点数,让你把这个数转化为 aEb 的形式,含义为 a * 10b, 其中 a ...

  3. Codeforces 767B. The Queue 模拟题

    B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...

  4. CF-697B Barnicle与691C Exponential notation

    无聊写两个题解吧,上午做比赛拉的,感触很多! B. Barnicle time limit per test 1 second memory limit per test 256 megabytes ...

  5. CodeForces - 344B Simple Molecules (模拟题)

    CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...

  6. CodeForces - 344D Alternating Current (模拟题)

    id=46667" style="color:blue; text-decoration:none">CodeForces - 344D id=46667" ...

  7. CodeForces - 344E Read Time (模拟题 + 二分法)

    E. Read Time time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  8. CodeForces 681C Heap Operations (模拟题,优先队列)

    题意:给定 n 个按顺序的命令,但是可能有的命令不全,让你补全所有的命令,并且要求让总数最少. 析:没什么好说的,直接用优先队列模拟就行,insert,直接放入就行了,removeMin,就得判断一下 ...

  9. codeforces 691C C. Exponential notation(科学计数法)

    题目链接: C. Exponential notation time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

随机推荐

  1. spring boot 静态变量注入配置文件

    spring 静态变量注入 spring 中不支持直接进行静态变量值的注入,我们看一下代码: @Component(value = "KafkaConfig") @Configur ...

  2. Java反射 - 简单的给Bean赋值和取值

    由于项目的实际需要,所以利用java反射原理写了一个简单给bean赋值和取值通用的类,在此记录下方便自己日后用到,也为需要的兄弟提供个参考例子. 工具类BeanRefUtil:   package c ...

  3. 在windows 下将 chm 格式的文件 转换成 html 的文件

    有时我们可能需要将 chm 格式的文件 转换成 html 格式的网页文件,这时,如果你使用的是 windows 操作系统,那就可以用 windows 操作系统自带的反编译工具来完成这项任务,具体步骤: ...

  4. python高亮显示输出

    知识内容: 1.高亮输出语法 2.高亮输出实例 前言: 在做购物车这道题时遇到了高亮显示输出某些内容的需求,于是就学了一下这方面的知识,以下是python高亮显示输出的使用方法: 购物车链接:  ht ...

  5. docker 配置pull源

    登录阿里云 找到镜像服务 在/etc/docker下创建daemon.json文件并写入 最后重启docker服务 sudo service docekr restart

  6. PHP过滤各种HTML标签的表达式,值得收藏

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...

  7. openlayers-热地图加载(完整版及代码)

    //地圖加載function mapInit(data){ //底图// var raster = new ol.layer.Tile({// source: new ol.source.Stamen ...

  8. IE浏览器中的加载项怎么删除

    IE浏览器中的加载项是一些软件或者浏览器的功能控件,我们可以通过禁用.开启来控制是否使用某些加载项,同时可以将一些加载项删除. 比如当我们遇到了一些不好的加载项,想要将它删除,通过这篇经验,教大家怎么 ...

  9. VB6单片机编程中的汉字处理

    在DOS时代,拥有一个华丽的汉字菜单几乎是每个高档中文应用程序必须的包装.中文Windows操作系统的出现使得高级开发平台实现全中文的提示和界面非常容易和方便.在一般的应用程序中已经很少需要去专门考虑 ...

  10. jdk下载--操作系统

    不同的操作系统需要下载不同的jdk. 查看操作系统的命令: Window系统下:>winver Linux和Unix系统下: >uname -a 根据系统不同选用不同的jdk: 下载地址: ...