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 ad 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

题目链接:http://codeforces.com/contest/697/problem/B

题意:参照样例
思路:模拟
注意一些特殊情况。2.0e0输出2;0.00e0输出0;0.0001e2输出0.01。注意消去前导0,后导0。 代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i;
int a,b;
char ch;
int d[];
scanf("%d",&a);
getchar();
int len=;
while((ch=getchar())&&ch!='e')
d[len++]=ch-'';
for(i=len-; i>=; i--)
if(d[i]) break;
len=i+;
scanf("%d",&b);
getchar();
int sign=;
if(a!=)
{
cout<<a;
sign=;
}
for(i=; i<len&&i<b; i++)
{
if(sign==&&d[i]==) continue;
else
{
cout<<d[i];
sign=;
}
}
if(sign!=&&len<b)
for(i=len; i<b; i++) cout<<"";
else if(len>b)
{
if(sign) cout<<".";
else cout<<"0.";
for(i=b; i<len; i++) cout<<d[i];
}
else if(sign==) cout<<"";
cout<<endl;
return ;
}

Codeforces 679B. Barnicle 模拟的更多相关文章

  1. CodeForces 697B Barnicle 模拟

    强行模拟 纪念一下…… #include<stdio.h> #include<iostream> #include<algorithm> #include<m ...

  2. Codeforces 389B(十字模拟)

    Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submi ...

  3. codeforces 591B Rebranding (模拟)

    Rebranding Problem Description The name of one small but proud corporation consists of n lowercase E ...

  4. Codeforces 626B Cards(模拟+规律)

    B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input outp ...

  5. Codeforces 631C. Report 模拟

    C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input out ...

  6. CodeForces 382C【模拟】

    活生生打成了大模拟... #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsig ...

  7. codeforces 719C (复杂模拟-四舍五入-贪心)

    题目链接:http://codeforces.com/problemset/problem/719/C 题目大意: 留坑...

  8. codeforces 697B Barnicle

    题目链接:http://codeforces.com/problemset/problem/697/B 题目大意: 将科学计数法用十进制表示.[如果类似于7.0应输出7] 解题思路: Java 中 B ...

  9. CodeForces 705C Thor (模拟+STL)

    题意:给定三个操作,1,是x应用产生一个通知,2,是把所有x的通知读完,3,是把前x个通知读完,问你每次操作后未读的通知. 析:这个题数据有点大,但可以用STL中的队列和set来模拟这个过程用q来标记 ...

随机推荐

  1. PS制作gif动图教程

    之前做过一些动图,时间久了就忘记了,每次心血来潮想做的时候又要重新找资料,网上的教程都不够完整,因此整理了一份完整的教程,针对PS新手(对,没错,就是博主自己哈哈). 准备工作:photoshop.图 ...

  2. 搭建Hive 2.1.1 基于Hadoop 2.6.1 和 Ubuntu 16.0.4 记录

        Hadoop Hive Hbase 对应版本 Hive官网下载 我们以Hadoop版本作为参考适配Hive Hbase即可, Hadoop版本是2.6.1 所以可以选择Hive1.2.1以上版 ...

  3. [Python] 分段线性插值

    利用线性函数做插值 每一段的线性函数: #Program 0.6 Linear Interploation import numpy as np import matplotlib.pyplot as ...

  4. VC字符串转换常用函数

    最近在做一些关于VC的ActiveX小插件,经常会遇到字符串处理的问题,狂查CSDN和MSDN,结果并不理想.先说明一下,相关处理函数在VC++6.00测试通过.也许很多人不能理解,现在都什么年代了, ...

  5. CUDA C Programming Guide 在线教程学习笔记 Part 4

    ▶ 图形互操作性,OpenGL 与 Direct3D 相关.(没学过,等待填坑) ▶ 版本号与计算能力 ● 计算能力(Compute Capability)表征了硬件规格,CUDA版本号表征了驱动接口 ...

  6. 返回标签数据示例 (PHP)

    标签接口函数 获取标签数据 array uc_tag_get(string tagname [, array nums]) 函数参数 参数 含义 string tagname 标签名称 array n ...

  7. 巧用JLINK来实现nrf51822的蓝牙设备流水号

    项目需求:在蓝牙广播的时候名字为 SN_设备流水号(如SN_00000001). 我们可以在原来的代码中进行一下修改和增加 ; 备注这个地址0X0001B160根据自己具体情况来设定 /**@brie ...

  8. HTML 表格标签

    <table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, ce ...

  9. bat 笔记 二

    @echo off echo 等待 ping -n 5 127.1 >null cls echo 我爱嘉怡 pause >null 第一条利用echo关键字关闭路径面板 第二条利用echo ...

  10. web 复制功能和span光标

    参考文章:https://www.cnblogs.com/tugenhua0707/p/7395966.html https://blog.csdn.net/woshinia/article/deta ...