2016 北邮暑期训练3-A题(CodeForces 697B Barnicle)白痴题
来源:互联网 发布:mysql导出sql文件 编辑:程序博客网 时间:2024/04/30 00:20
Description
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).
Sample Input
Input
8.549e2
Output
854.9
Input
8.549e3
Output
8549
Input
0.33e0
Output
0.33
题目大意:
输入一个科学记数法表示的数字,转换成对应的整数或者浮点数,精度为100位。
题目分析:
就是用python的自动转换实现,一开始考虑用的是浮点数,但会丢精度,因为64位浮点数只能表示2^64个数远小于10^100,所以改用Decimal包。
ac代码:
from decimal import *a=input()b=Decimal(a)if(round(b)==b): print ("%d"%b)else: print (b)
- 2016 北邮暑期训练3-A题(CodeForces 697B Barnicle)白痴题
- 2016 北邮暑期训练3-C题(CodeForces 699BOne Bomb)白痴题
- 2016 北邮暑期训练3-D题(Codeforces 698A Vacations)DP,水题
- Codeforces-697B Barnicle
- Codeforces 697B Barnicle
- CodeForces 697B Barnicle
- Codeforces-697B-Barnicle(模拟)
- Codeforces 697B. Barnicle(模拟)
- CodeForces 697 B. Barnicle(简单模拟)
- CodeForces - 697B Barnicle (高精度小数点)
- Codeforces-697B Barnicle(模拟)
- 暑期集训Day2训练赛D题Spreadsheets(codeforces 1B)
- 暑期训练赛(6)A题
- codeforces 697B. Barnicle - 字符串变数字
- 2016 北邮暑期训练3-F题( POJ2342 Anniversary party)树状DP
- 2016ACM竞赛训练暑期课期末考试 a题
- CodeForces 697B Barnicle 和 Codeforce 691 C Puzzles 科学计数法的正逆互推 CodeForces 691B 一个对称的小题;
- codeforce 697B Barnicle
- csdn待改进点之34------>为什么会又在乱跳转? 请不要说重现不了!
- 在eclipse中使用CDT插件导入外部静态库
- 二分查找
- 国内一线互联网公司内部面试题库
- Mac+idea开发Java提速快捷键总结
- 2016 北邮暑期训练3-A题(CodeForces 697B Barnicle)白痴题
- Ugly Number
- PHP函数之array_key_exists
- Pycharm Professional 激活服务器
- Hadoop--The Definitive Book_4th Contents
- 快排为什么那么快
- 多线程 —— 使用锁编写线程安全的程序
- NAT技术的原理
- 使用一个类代替资源文件代码