Barnicle

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
分析:注意0.0e0;
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <ext/rope>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define vi vector<int>
#define pii pair<int,int>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
const int maxn=1e5+;
const int dis[][]={{,},{-,},{,-},{,}};
using namespace std;
using namespace __gnu_cxx;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p;p=p*p;q>>=;}return f;}
int n,m,now,len,cnt;
string a,ans;
int main()
{
int i,j,k,t;
cin>>a;
len=a.length(); //特判;
if(a=="0.0e0")return *puts(""); //找分隔符e;
for(now=;a[now]!='e';now++); //计算进位;
for(i=now+;i<len;i++)cnt=cnt*+a[i]-'';
ans+=a[]; //进位;
for(i=;i<cnt&&a[+i]!='e';i++)ans+=a[+i],now=+i; if(i!=cnt)for(;i<cnt;i++)ans+='';//不足补0;
else
{
ans+='.'; //小数部分;
for(;a[+i]!='e';i++)ans+=a[+i],now=+i;
} //处理答案前多余0;
for(i=;ans[i]=='';i++);
if(ans[i]=='.')i--;
ans.erase(,i); //处理小数点后末尾0;
len=ans.length();
if(count(ans.begin(),ans.end(),'.')!=)
{
len=ans.length();
for(i=len-;i>=&&(ans[i]==''||ans[i]=='.');i--);
ans=ans.substr(,i+);
}
cout<<ans<<endl;
//system ("pause");
return ;
}



 

Barnicle的更多相关文章

  1. CodeForces #362 div2 B. Barnicle

    题目链接: B. Barnicle 题意:给出科学计数法 转化成十进制的整数或小数 并输出. 思路:暑假训练赛见过了,当时大腿A掉了,并表示是道水题. 刷CF再次遇见,毫不留情WA了几次.比如: 0. ...

  2. Codeforces Round #362 (Div. 2)->B. Barnicle

    B. Barnicle time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  3. Codeforces 679B. Barnicle 模拟

    B. Barnicle time limit per test: 1 second memory limit per test :256 megabytes input: standard input ...

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

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

  5. 【CodeForces 697B】Barnicle

    对科学计数法表示的数,输出其10进制的形式. c++来做,需要考虑这些细节: 当b==0,d==0时,只输出a. 当不需要补零的情况有两种: 一种是刚好是整数,只输出a(注意1.0e1的情况是输出1) ...

  6. codeforces 697B Barnicle

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

  7. CodeForces 697B Barnicle 模拟

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

  8. 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 ...

  9. Codeforces Round #362

    A - Pineapple Incident #pragma comment(linker, "/STACK:102c000000,102c000000") #include &l ...

随机推荐

  1. LeetCode OJ 217.Contains Duplicate

    Given an array of integers, find if the array contains any duplicates. Your function should return t ...

  2. centos 7 切换运行模式

    如设置命令行级别方法: systemctl set-default multi-user.target 设置窗口级别方法: systemctl set-default graphical.target

  3. Django:之中间件、微信接口和单元测试

    Django中间件 我们从浏览器发出一个请求 Request,得到一个响应后的内容 HttpResponse ,这个请求传递到 Django的过程如下: 也就是说,每一个请求都是先通过中间件中的 pr ...

  4. unlinking

    When a file name is deleted from the directory tree, the file name's connection to the inode number ...

  5. 购物车(Shopping cart) —— B2C网站核心产品设计 (二)

    购物车是做什么的? 我们先来看一下现实超市中的购物车,一个带四个轱辘的铁筐子,客人推来推去,看到什么东西喜欢,就扔进去,觉得东西差不多了,就推到收银台. 那B2C网站中的购物车又是一个什么东西呢? 从 ...

  6. ASP.NET 会话状态的模式

    ASP.NET 会话状态为会话数据提供了几个不同的存储选项.每个选项都通过一个 SessionStateMode 枚举值进行识别.如下列表中描述了可用的会话状态模式: InProc 模式:把会话状态存 ...

  7. Redis和Memcached的区别【转】

    如果简单地比较Redis与Memcached的区别,大多数都会得到以下观点:1 Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,hash等数据结构的存储.2 Redis支持数据 ...

  8. C# List<T> To DataTable

    public DataTable ConvertToDataTable<T>(IList<T> data) { PropertyDescriptorCollection pro ...

  9. MVC 和 MVVM

    MVVM MVVM 是 Model-View-ViewModel 的简写,MVVM 模式和 MVC 模式一样,主要目的是分离视图(View)和模型(Model) MVC 回顾 MVC 结构图 MVC ...

  10. git 使用系列(二)---- 分支和合并

    Branching and Merging The Git feature that really makes it stand apart from nearly every other SCM o ...