Codeforces 679B. Barnicle 模拟
1 second
:256 megabytes
standard input
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.
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.
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).
8.549e2
854.9
8.549e3
8549
0.33e0
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 模拟的更多相关文章
- CodeForces 697B Barnicle 模拟
强行模拟 纪念一下…… #include<stdio.h> #include<iostream> #include<algorithm> #include<m ...
- Codeforces 389B(十字模拟)
Fox and Cross Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submi ...
- codeforces 591B Rebranding (模拟)
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase E ...
- Codeforces 626B Cards(模拟+规律)
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input outp ...
- Codeforces 631C. Report 模拟
C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input out ...
- CodeForces 382C【模拟】
活生生打成了大模拟... #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsig ...
- codeforces 719C (复杂模拟-四舍五入-贪心)
题目链接:http://codeforces.com/problemset/problem/719/C 题目大意: 留坑...
- codeforces 697B Barnicle
题目链接:http://codeforces.com/problemset/problem/697/B 题目大意: 将科学计数法用十进制表示.[如果类似于7.0应输出7] 解题思路: Java 中 B ...
- CodeForces 705C Thor (模拟+STL)
题意:给定三个操作,1,是x应用产生一个通知,2,是把所有x的通知读完,3,是把前x个通知读完,问你每次操作后未读的通知. 析:这个题数据有点大,但可以用STL中的队列和set来模拟这个过程用q来标记 ...
随机推荐
- 开发组件:REST API
REST API 最佳入门指南 https://blog.csdn.net/px01ih8/article/details/78674685
- http协议和https协议
内容: 1.http协议介绍 2.https协议介绍 3.http协议和https协议对比 1.http协议介绍 (1)http协议是什么 1 一个传输协议,协议就是双方都遵守的规范. 2 为什么叫超 ...
- windows配置ftp服务器
一.搭建FTP 二.解决FTP因windows防火墙拦截的方法 三.配置FTP用户 ========================================================== ...
- java求两个数百分比,精确到指定位数
// 获取百分比,不带小数点 private String getPercentage(String num, String total){ NumberFormat numberFormat = N ...
- Json中相同或者重复记录的值相加组成新的Json
var data = [ {"Networking": "WiFi", "count_value": "2000"}, ...
- as3 对于加载进来多层swf缩放操作
//swf实际尺寸 var oldWidth:Number = frameLder.contentLoaderInfo.content.width; var oldHeight:Number = fr ...
- 下载google code中源码的几个工具
Google code 一般以三种命令行方式提供源代码,格式如下: hg clone https://code.google.com/p/xxx/ git clone https://code.goo ...
- WDA-FPM-3-SEARCH(OIF)
转载:https://www.cnblogs.com/sapSB/p/10097830.html FPM三:简单的SEARCH(OIF) 这里是使用FPM Workbench自动生成的,没有去SE ...
- Hive 和 HBase区别
作者:yuan daisy 链接:https://www.zhihu.com/question/21677041/answer/78289309 来源:知乎 著作权归作者所有.商业转载请联系作者获得授 ...
- ArcGIS案例学习笔记3_2
ArcGIS案例学习笔记3_2 联系方式:谢老师,135-4855-4328, xiexiaokui#qq.com 时间:第3天下午 内容:CAD数据导入,建库和管理 目的:生成地块多边形,连接属性, ...