1. # ATM
  2. import sys
  3.  
  4. withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结尾的\n符号
  5.  
  6. if int(withdraw) % 5 != 0 or balance < (withdraw + 0.5): # 1.注意手续费,缺少手续费也不能取 2.xy0~2000是测试值要求,不用判断
  7. print("%.2f" % balance)
  8. else:
  9. print("%.2f" % (balance - withdraw - 0.5))

学习

  数据

    类型要求

      map转float

    精读输出

      "%.2f"

    读取

      sys标准库的引入, stdlib/io

      用split()一次读取两个

犯错

  \n尾部符号去掉

  py缩进注意

  0.5手续费

  中文字符混入犯错

  系统内含的测试数据规格,很多都不用自己多加一道判断了

ATM Solved Problem code: HS08TES的更多相关文章

  1. Factorial Solved Problem code: FCTRL

    import sys #import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法 r = 0 whi ...

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

  3. Small factorials Solved Problem code: FCTRL2

    import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了retur ...

  4. Enormous Input Test Solved Problem code: INTEST

    import sys import psyco #一键优化库 psyco.full() def main(): n, k = map(int, sys.stdin.readline().strip() ...

  5. Cooking Schedule Problem Code: SCHEDULE(优先队列)

    Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his ...

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

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

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

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

随机推荐

  1. 转:6款Java转C#的最佳工

    原文来自于:http://designzum.com/2014/03/27/best-tools-to-convert-java-to-c-source-code/ ava is the class ...

  2. java.io.FileNotFoundException: /exapp/hadoop/name/current/VERSION (Permission denied)

    http://blog.csdn.net/blackiez/article/details/8570395

  3. http状态码有那些?分别代表是什么意思

    http状态码有那些?分别代表是什么意思? 简单版 [ 100 Continue 继续,一般在发送post请求时,已发送了http header之后服务端将返回此信息,表示确认,之后发送具体参数信息 ...

  4. Android动画效果

    layout_left_in.xml <?xml version="1.0" encoding="utf-8"?> <layoutAnimat ...

  5. 命名实参和可选实参(C# 编程指南)

    https://msdn.microsoft.com/zh-cn/library/dd264739.aspx CalculateBMI(weight: 123, height: 64); Calcul ...

  6. HDU_2058——等差数列,子集,集合长度判断

    Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-se ...

  7. Map的遍历方法及String和其它类型的相互转化

    Map的遍历方法: package com.lky.test; import java.util.HashMap; import java.util.Iterator; import java.uti ...

  8. Css轮廓

    css code: p{ outline-width:2px; outline-color:aqua; outline-style: groove; }

  9. Django之路由系统

    一.路由系统介绍 在django程序中,可以通过urls.py文件对所有的url进行任务的分配,根据路由规则的定义选择不同的业务处理函数进行处理 二.路由规则定义 1.路由规则代码如下,mysite/ ...

  10. c++应用程序文件的编译过程

    这里讲下C++文件的编译过程及其中模板的编译过程: 一:一般的C++应用程序的编译过程.     一般说来,C++应用程序的编译过程分为三个阶段.模板也是一样的. 在cpp文件中展开include文件 ...