ATM Solved Problem code: HS08TES
# ATM
import sys withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结尾的\n符号 if int(withdraw) % 5 != 0 or balance < (withdraw + 0.5): # 1.注意手续费,缺少手续费也不能取 2.xy0~2000是测试值要求,不用判断
print("%.2f" % balance)
else:
print("%.2f" % (balance - withdraw - 0.5))
学习
数据
类型要求
map转float
精读输出
"%.2f"
读取
sys标准库的引入, stdlib/io
用split()一次读取两个
犯错
\n尾部符号去掉
py缩进注意
0.5手续费
中文字符混入犯错
系统内含的测试数据规格,很多都不用自己多加一道判断了
ATM Solved Problem code: HS08TES的更多相关文章
- Factorial Solved Problem code: FCTRL
import sys #import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法 r = 0 whi ...
- Double Strings Solved Problem code: DOUBLE
# Fuking silly, OTZ.... import sys def main(): n = int(raw_input()) for num in sys.stdin: if int(num ...
- Small factorials Solved Problem code: FCTRL2
import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了retur ...
- Enormous Input Test Solved Problem code: INTEST
import sys import psyco #一键优化库 psyco.full() def main(): n, k = map(int, sys.stdin.readline().strip() ...
- Cooking Schedule Problem Code: SCHEDULE(优先队列)
Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his ...
- Holes in the text Add problem to Todo list Problem code: HOLES
import sys def count_holes(letter): hole_2 = ['A', 'D', 'O', 'P', 'Q', 'R'] if letter == 'B': return ...
- The Lead Game Add problem to Todo list Problem code: TLG
'''def count_lead(first, second): if first > second: return 1, first - second elif first == secon ...
- Turbo Sort Add problem to Todo list Problem code: TSORT
def heap_sort(ary): n = len(ary) first = int(n / 2 - 1) for start in range(first, -1, -1): # 3~0 rev ...
- Use Spring Insight Developer to Analyze Code, Install it with Tomcat, and Extend it with Plugins--转载
原文地址:http://www.tomcatexpert.com/blog/2012/12/05/use-spring-insight-developer-analyze-code-install-i ...
随机推荐
- Top 100 English Verbs
accept allow ask believe borrow break bring buy can/be able cancel change clean comb complain cough ...
- ThreadLocal<T>类
ThreadLocal<T>类 -------每个线程有仅拥有一个T对象 ...
- 通过MYSQL命令行直接建数据库
因为同事要求,在进行MYSQLDUMP的导入库时,加一个日期标签, BUT,MYSQLDUMP的前提是数据库中要存在数据库名, 于是通过-e 参数执行命令. 这让我想起了前不久请教同事,如果AWK传变 ...
- cf509A Maximum in Table
A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Android SDK下载和更新失败的解决方法!!!
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml. 据说dl-ssl.google.c ...
- Android中ListView通过BaseAdapter实现数据的绑定
1. public class ListFiles extends Activity { ListView Listview=null; protected void onCreate(Bundle ...
- 解析了grid2008的代码
import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.L ...
- 【C#基础】CSA控件编写秘籍
新建CSA控件 1.新建一个纯类,命名空间是: namespace SimPerfect.CSAControlLibrary.CSAControls 2.实现两个构造函数:无参和传Candy参数 pu ...
- Apache https 配置指南
Windows Apache HTTPS配置创建下面3个目录: C:\Program Files\Apache Group\Apache2\conf\sslC:\Program Files\Apach ...
- SMO(Sequential Minimal Optimization) 伪代码(注释)
Algorithm: Simplified SMO 这个版本是简化版的,并没有采用启发式选择,但是比较容易理解. 输入: C: 调和系数 tol: 容差 (tolerance) max passes: ...