C. Exponential notation

题目连接:

http://www.codeforces.com/contest/691/problem/C

Description

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.

English alphabet

You are given a string s. Check if the string is "s-palindrome".

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.

Sample Input

16

Sample Output

1.6E1

Hint

题意

给你一个数字,让你转化成科学计数法

题解:

记录第一个数字出现的位置,最后一个数字出线的位置,点出现的位置

然后瞎统计一下就好了

代码

#include<bits/stdc++.h>
using namespace std;
void p(int x){
if(x==0)return;
printf("E%d",x);
}
int main(){
string s;
cin>>s;
int a=-1,b=-1,c=s.size();
for(int i=0;i<s.size();i++){
if(s[i]=='.')c=i;
}
for(int i=0;i<s.size();i++){
if(s[i]=='0'||s[i]=='.')continue;
a=i;break;
}
for(int i=s.size()-1;i>=0;i--){
if(s[i]=='0'||s[i]=='.')continue;
b=i;break;
}
if(a==b){
printf("%c",s[a]);
if(c<a)p(c-a);//printf("E%d",c-a);
else p(c-a-1);//printf("E%d",c-a-1);
return 0;
}
cout<<s[a]<<".";
for(int i=a+1;i<=b;i++)
{
if(s[i]=='.')continue;
cout<<s[i];
}
if(c<a)p(c-a);//printf("E%d",c-a);
else p(c-a-1);//printf("E%d",c-a-1);
}

Educational Codeforces Round 14 C. Exponential notation 数字转科学计数法的更多相关文章

  1. 解决HTML导出Excel表数字变成科学计数法

    - js 中导出excel 较长数字串会变成科学计数法 在做项目中,碰到如题的问题.比如要将居民的信息导出到excel中,居民的身份证号码因为长度过长(大于10位),excel会自动的将过长的数字串转 ...

  2. java使用poi解析或处理excel的时候,如何防止数字变成科学计数法的形式和其他常见Excel中数据转换问题

    当使用POI处理excel的时候,遇到了比较长的数字,虽然excel里面设置该单元格是文本类型的,但是POI的cell的类型就会变成数字类型. 而且无论数字是否小数,使用cell.getNumberi ...

  3. mysql导出csv文件excel打开后数字用科学计数法显示且低位变0的解决方法

    Excel显示数字时,如果数字大于12位,它会自动转化为科学计数法:如果数字大于15位,它不仅用于科学技术费表示,还会只保留高15位,其他位都变0. Excel打开csv文件时,只要字段值都是数字,它 ...

  4. 导出csv用excel打开后数字不用科学计数法显示(0123456显示123456)

    从这儿抄过来的: http://zhejiangyinghui.iteye.com/blog/1149526 最近写了一个生成csv的程序,生成的csv其中有一列数字长度为13位,csv中查看没有问题 ...

  5. 解决navicat 导出excel数字为科学计数法问题

    1.原因分析      用程序导出的csv文件,当字段中有比较长的数字字段存在时,在用excel软件查看csv文件时就会变成科学技术法的表现形式.     其实这个问题跟用什么语言导出csv文件没有关 ...

  6. Laravel 使用 maatwebsite/excel 时长数字出现科学计数法的解决办法

    在使用 maatwebsite/excel 包导出Excel的时候,有的单元格里会存放手机号等一大串的数字,这一串数字会被Excel软件处理为科学计数法,在后续处理数据的时候会产生不小的麻烦,一个个去 ...

  7. Educational Codeforces Round 14

    A - Fashion in Berland 水 // #pragma comment(linker, "/STACK:102c000000,102c000000") #inclu ...

  8. php 解决返回数据 数字 变成科学计数法后转换问题

    链接 https://blog.csdn.net/liuxin_0725/article/details/81514961 问题 id int型 数字过长,json_decode的时候已经转成科学计数 ...

  9. Educational Codeforces Round 14 - F (codeforces 691F)

    题目链接:http://codeforces.com/problemset/problem/691/F 题目大意:给定n个数,再给m个询问,每个询问给一个p,求n个数中有多少对数的乘积≥p 数据范围: ...

随机推荐

  1. Linux 网卡流量查看

    网卡流量查看 watch more /proc/net/dev # 实时监控流量文件系统 累计值 iptraf # 网卡流量查看工具 nethogs -d 5 eth0 eth1 # 按进程实时统计网 ...

  2. HDU 1241 Oil Deposits DFS搜索题

    题目大意:给你一个m*n的矩阵,里面有两种符号,一种是 @ 表示这个位置有油田,另一种是 * 表示这个位置没有油田,现在规定相邻的任意块油田只算一块油田,这里的相邻包括上下左右以及斜的的四个方向相邻的 ...

  3. 主流服务器apache,iis,tomcat,jboss,resion,weblogic,websphere的区别

    在互联网高速发展的今天,不同种类的网站大量涌现,每个人都在享受着网络服务带来的便利.而创建自己的个性化网站的门槛不断降低.从事网站架构,这种当年的绝对“”高科技“”绝活.也从it人员的专利“”沦落“” ...

  4. thinkphp5学习总结!

    数据库操作之原生sql操作 <?php namespace app\index\controller; use think\Db; class Index { public function i ...

  5. 常用的C#编译命令

    使用 csc.exe 实现命令行生成 作为一个半路出家的非计算机专业出身的前端码农,最近对C#很感兴趣,原因如下: 1.希望通过学习C#能熟悉一下windows系统和一些概念,例如:windows服务 ...

  6. npm tls证书报错

    Error: unable to verify the first certificate 设置node环境(零时使用,再次使用需要重新使用) set NODE_TLS_REJECT_UNAUTHOR ...

  7. spirngboot 注解方式注入自定义参数

    在代码中 @value("oracle.user") private String user; 在配置文件中 oracle.user=root

  8. Linux学习笔记:sed删除、插入数据

    一.sed删除文件第一行 sed -i '1d' file.txt -- 删除第一行 sed -i 'nd' file.txt -- 删除第n行 sed -i '$d' file.txt -- 删除最 ...

  9. 玲珑OJ 1129 - 喵哈哈村的战斗魔法师丶坏坏い月

    1129 - 喵哈哈村的战斗魔法师丶坏坏い月 Time Limit:3s Memory Limit:256MByte Submissions:315Solved:71 DESCRIPTION 坏坏い月 ...

  10. GetNumber的实现(Python & Java & Golang)

    TCO2014的编程赢取门票的题目,大致是从一个数组(大小为K),可以选取1-K个数,必须保证这n个数是从1-n,返回所有的选取方法个数. 思路:首先是得到从1开始连续的数,保存每个数的个数.然后通过 ...