Exponential notation

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 a and 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
分析:这种题要多注意细节!
代码:
#include <bits/stdc++.h>
using namespace std;
int n,m,cnt,len,l,r,now;
string a,ans;
int main()
{
int i,j,k,t;
cin>>a;
len=a.length();
//找小数点;
for(now=;now<len&&a[now]!='.';now++);
//找左端点和右端点;
if(a[l]=='.')l++;if(a[r]=='.')r--;
for(l=;a[l]=='';l++);
if(a[l]=='.')for(l++;a[l]=='';l++);
for(r=len-;a[r]=='';r--);
if(a[r]=='.')for(r--;a[r]=='';r--); ans+=a[l];
if(r!=l){
ans+='.';
for(i=l+;i<=r;i++)if(a[i]!='.')ans+=a[i];
}
cnt=now-(l+);
if(l+>now)cnt++;
cout<<ans;
if(cnt)cout<<"E"<<cnt;
cout<<endl;
//system("pause");
return ;
}

Exponential notation的更多相关文章

  1. Educational Codeforces Round 14 C. Exponential notation 数字转科学计数法

    C. Exponential notation 题目连接: http://www.codeforces.com/contest/691/problem/C Description You are gi ...

  2. Codeforces 691C. Exponential notation 模拟题

    C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: st ...

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

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

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

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

  5. 【模拟】Codeforces 691C Exponential notation

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

  6. Codeforces 691C. Exponential notation

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

  7. D3中动画(transition函数)的使用

    关于transition的几个基本点: 1. transition()是针对与每个DOM element的,每个DOM element的transition并不会影响其他DOM element的tra ...

  8. jQuery静态方法isFunction,isArray,isWindow,isNumeric使用和源码分析

    上一篇随笔中总结了js数据类型检测的几个方法和jQuery的工具方法type方法,本篇要分析几个方法都依赖type方法,所以不了解type方法的请先参看http://www.cnblogs.com/y ...

  9. [Linux-shell] AWK

    Go to the first, previous, next, last section, table of contents. Printing Output One of the most co ...

随机推荐

  1. 使用CSS灵活的盒子

    CSS3灵活的盒子,或flexbox,是一个布局模式提供页面上的元素的安排这样的元素表现可以预见当页面布局必须适应不同屏幕大小和不同的显示设备.对于许多应用程序,灵活的块盒模型提供了一个改进模型,它不 ...

  2. Android软件盘InputMethodManager

    调用下面代码:(第一次调用显示,再次调用则隐藏,如此反复),this指activity InputMethodManager imm = (InputMethodManager)this.getSys ...

  3. 大数据量情况下求top N的问题

    上周五的时候去参加了一个面试,被问到了这个问题.问题描述如下: 假如存在一个很大的文件,文件中的每一行是一个字符串.请问在内存有限的情况下(内存无法加载这个文件中的所有内容),如何计算出出现频率最高的 ...

  4. HDU2504:又见GCD

    Problem Description 有三个正整数a,b,c(0<a,b,c<10^6),其中c不等于b.若a和c的最大公约数为b,现已知a和b,求满足条件的最小的c.   Input ...

  5. shell:crontab

    crontab */1 * * * * (cd /home/q/system/project; /usr/bin/lockf -t 0 /tmp/discuz_bbs_audit.lock /usr/ ...

  6. 获取IP地址bash[转载]

    ipaddr=`/sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d : -f2 | awk '{print $1}'`

  7. 笨方法学python--第一个程序

    该章主要知识点有: 1 print 打印,有双引号,单引号 2 分析报错信息,积累经验 3 # -*- coding:utf-8 -*-,可以输出汉字 4 井号,# ,注释, 英文名 octothor ...

  8. iabtis初探

    1.简介 与Hibernate相比,ibatis属于一种半自动的ORM框架,主要解决了java对象与SQL入参及结果集的映射关系.简单易学.容易上手:但是安全性较差,对于金融等对安全要求较高的系统来说 ...

  9. 百度,google的地理编码

    1.百度的地理编码:(不支持中国以外的其它城市) http://api.map.baidu.com/geocoder/v2/?ak=E974997f80db18330f8f5c61d084a677&a ...

  10. JavaScript的第一次小结

    一. JavaScript是一种的脚本语言:特点是:具有解释性,基于对象,事件驱动,安全性和跨平台等特点 对于这几种特点有必要说明一下 解释性:就是JavaScripte本身就是一种解释性语言 基于对 ...