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 ...
随机推荐
- mobile javascript
http://www.cnblogs.com/zhepama/archive/2013/06/01/3112023.html http://www.csdn.net/article/2014-01-0 ...
- BZOJ2659: [Beijing wc2012]算不出的算式
2659: [Beijing wc2012]算不出的算式 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 668 Solved: 366[Submit] ...
- js中iframe的用法
最近遇到的项目总是习惯左边一个树,点击每个树的节点右边出现相应的信息,遇到这种情况用iframe还是很简单的, 例如 : 页面文件 @section Tree{ <ul id="tre ...
- 安卓,分享到facebook的若干种方法汇总
近期做了facebook的分享功能,遇到了很多问题,这里总结一下,供大家参考,不足之处还请大家指正. facebook分享方式: 1.通过intent调用调用本地facebook应用方式 支持单独分享 ...
- java--字节数组输入、输出流
在java网络编程中,字节数组很重要,它可以传输任何资料(文本,音频,视频,图片等),因此掌握字节数组和其它数据类型的相互转化尤为重要. 示例代码: package com.lky.util; imp ...
- Create a simple REST web service with Python--转载
今日尝试用python建立一个restful服务. 原文地址:http://www.dreamsyssoft.com/python-scripting-tutorial/create-simple-r ...
- Freemarker生成静态代码实例
1.static.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http ...
- Horizontal,vertical,Input_Mouse,Input_Key
鼠标获取 using UnityEngine; using System.Collections; public class Input_Mouse : MonoBehaviour { void Up ...
- 使用awrextr.sql导出awr原始数据
1.AWR原始数据与AWR报告的差别 AWR原始数据: 是oracle数据库mmon进程定期将统计量从内存转储至磁盘,并以结构化的形式存入若干张表组成自己主动工作负荷存储仓库(AutomaticWor ...
- 飞行模式下不让打开FM
android 判断手机当前是否是飞行模式,在AirplaneModeEnabler中 提供了isAirplaneModeOn方法来判断当前是否是Airplane mode:public stati ...