B. Barnicle
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate.

Barney asked the bar tender Carl about this distance value, but Carl was so busy talking to the customers so he wrote the distance value (it's a real number) on a napkin. The problem is that he wrote it in scientific notation. The scientific notation of some real number x is the notation of form AeB, where A is a real number and B is an integer and x = A × 10B is true. In our case A is between 0 and 9 and B is non-negative.

Barney doesn't know anything about scientific notation (as well as anything scientific at all). So he asked you to tell him the distance value in usual decimal representation with minimal number of digits after the decimal point (and no decimal point if it is an integer). See the output format for better understanding.

Input

The first and only line of input contains a single string of form a.deb where a, d and b are integers and e is usual character 'e' (0 ≤ a ≤ 9, 0 ≤ d < 10100, 0 ≤ b ≤ 100) — the scientific notation of the desired distance value.

a and b contain no leading zeros and d contains no trailing zeros (but may be equal to 0). Also, b can not be non-zero if a is zero.

Output

Print the only real number x (the desired distance value) in the only line in its decimal notation.

Thus if x is an integer, print it's integer value without decimal part and decimal point and without leading zeroes.

Otherwise print x in a form of p.q such that p is an integer that have no leading zeroes (but may be equal to zero), and q is an integer that have no trailing zeroes (and may not be equal to zero).

Examples
Input
8.549e2
Output
854.9
Input
8.549e3
Output
8549
Input
0.33e0
Output
0.33

题意:x = A × 10B 将科学计数法 转为为普通实数  不能有前导零  不能有后置零  
hack数据
0.0e0
0
2.40000e2
240 题解:模拟 注重细节处理 考虑要细致
 #include<bits/stdc++.h>
#define ll __int64
#define mod 1e9+7
#define PI acos(-1.0)
#define bug(x) printf("%%%%%%%%%%%%%",x);
using namespace std;
char a[];
char b[];
int main()
{
cin>>a;
int len=strlen(a);
int wei=;
int flag;
for(int i=;i<len;i++)//找到小数点
{
if(a[i]=='.')
flag=i;
}
int gg=;
int zha=;
for(int j=len-;j>flag;j--)//进多少位
{
if(a[j]=='e')
{
a[j]='\0';
break;
}
wei=wei+(a[j]-'')*gg;
gg*=;
a[j]='\0';
} len=strlen(a);
int weishu=len-(flag+);//现有小数位数
if(wei==&&weishu==&&a[]=='')//特判数据
{
cout<<a[]<<endl;
return ;
}
if(wei<weishu)
{
for(int j=flag;j<flag+wei;j++)
a[j]=a[j+];
a[flag+wei]='.';
}
if(wei==weishu)
{
for(int j=flag;j<flag+wei;j++)
a[j]=a[j+];
a[flag+wei]='\0';
}
if(wei>weishu)
{
for(int j=flag;j<flag+weishu;j++)
a[j]=a[j+];
for(int j=flag+weishu;j<flag+wei;j++)
a[j]='';
a[flag+wei]='\0';
}
int len1=strlen(a);
int aaa=;
int zzz=;
if(wei<weishu)//去掉后置零
{
for(int j=len1-;j>;j--)
{
if(zzz)
break;
if(a[j]!='')
zzz=;
if(a[j]==''||a[j]=='.')
a[j]='\0'; }
}
for(int i=;i<len1;i++)//去掉前导零
{
if(a[i]!=''||a[i+]=='.')
aaa=;
if(aaa)
{
cout<<a[i];
}
}
cout<<endl;
return ;
}

Codeforces Round #362 (Div. 2) B 模拟的更多相关文章

  1. Codeforces Round #249 (Div. 2) (模拟)

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. Codeforces Round #366 (Div. 2) C 模拟queue

    C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  3. Codeforces Round #362 (Div. 2) C. Lorenzo Von Matterhorn (类似LCA)

    题目链接:http://codeforces.com/problemset/problem/697/D 给你一个有规则的二叉树,大概有1e18个点. 有两种操作:1操作是将u到v上的路径加上w,2操作 ...

  4. #map+LCA# Codeforces Round #362 (Div. 2)-C. Lorenzo Von Matterhorn

    2018-03-16 http://codeforces.com/problemset/problem/697/C C. Lorenzo Von Matterhorn time limit per t ...

  5. 题解——Codeforces Round #508 (Div. 2) T1 (模拟)

    依照题意暴力模拟即可A掉 #include <cstdio> #include <algorithm> #include <cstring> #include &l ...

  6. Codeforces Round #281 (Div. 2) B 模拟

    B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  7. Codeforces Round #281 (Div. 2) A 模拟

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  8. 【转载】【树形DP】【数学期望】Codeforces Round #362 (Div. 2) D.Puzzles

    期望计算的套路: 1.定义:算出所有测试值的和,除以测试次数. 2.定义:算出所有值出现的概率与其乘积之和. 3.用前一步的期望,加上两者的期望距离,递推出来. 题意: 一个树,dfs遍历子树的顺序是 ...

  9. Codeforces Round #362 (Div. 2) A.B.C

    A. Pineapple Incident time limit per test 1 second memory limit per test 256 megabytes input standar ...

随机推荐

  1. PageHelper 记录总条数不正确问题处理

    //PageHelper.startPage会返回一个page对象,这个对象在查询结果出来后会把页数,记录总数给page对象,用page.getPages()和getTotal()获取页数和记录总数. ...

  2. cuda中当元素个数超过线程个数时的处理案例

    项目打包下载 当向量元素超过线程个数时的情况 向量元素个数为(33 * 1024)/(128 * 128)=2.x倍 /* * Copyright 1993-2010 NVIDIA Corporati ...

  3. java基础面试题:抽象类中是否可以有静态的main方法?

  4. 关于小程序button控件上下边框的显示和隐藏问题

    问题: 小程序的button控件上下有一条淡灰色的边框,在空件上加上了样式 border:(none/0); 都没办法让button上下的的边框隐藏: 代码如下 <button class=&q ...

  5. 定位设备--llseek实现

    /** 如果llseek实现lseek和llseek系统调用,如果未定义llseek方法, 内核默认修改file结构体中的f_pos成员来实现定位,如果是操作一个 设备,则需提供自己的llseek方法 ...

  6. 牛客NOIP提高组R1 A中位数(二分)

    题意 题目链接 Sol 很神仙的题目啊,考场上只会$n^2$的暴力.. 考虑直接二分一个$mid$,我们来判断最终答案是否可能大于$x$. 判断的时候记录一下前缀最小值即可, 设$s[i]$表示$1- ...

  7. linux下安装redis和使用

    http://www.linuxidc.com/Linux/2014-05/101979.htm

  8. indexOf和contains查找的字符串是空字符,返回值是什么呢?

    一直以为indexOf方法查找的字符串如果不匹配返回值就是-1.今天发现空字符返回值是0.看源码原来如此,阴沟里翻船啊!

  9. mysql基础,数据表的类型

  10. 转发一个关于下载qq无损音乐的博客

    import requests import json headers = { 'Host': 'c.y.qq.com', 'Referer': 'http://c.y.qq.com/', 'User ...