2015年5月9日
摘要: Link https://www.hackerrank.com/challenges/service-lanedef main(): n, t = map(int, raw_input().split()) arr = raw_input().split() # 这句自动将输入的数据切... 阅读全文
posted @ 2015-05-09 09:43 sangocare 阅读(156) 评论(0) 推荐(0) 编辑
2015年5月8日
摘要: 1 def main(): 2 n = int(raw_input()) 3 sum = 0 4 for i in range(n): 5 sum += float(raw_input()) 6 7 8 print '%.1f' % (sum /... 阅读全文
posted @ 2015-05-08 09:39 sangocare 阅读(136) 评论(0) 推荐(0) 编辑
2015年5月7日
摘要: 1 # Fuking silly, OTZ.... 2 3 import sys 4 5 6 def main(): 7 n = int(raw_input()) 8 9 for num in sys.stdin:10 if int(num) % 2 == ... 阅读全文
posted @ 2015-05-07 15:40 sangocare 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 1 '''def count_lead(first, second): 2 if first > second: 3 return 1, first - second 4 elif first == second: # 题目中没有说明相等的情况 5 ... 阅读全文
posted @ 2015-05-07 12:51 sangocare 阅读(170) 评论(0) 推荐(0) 编辑
2015年5月6日
摘要: 1 def heap_sort(ary): 2 n = len(ary) # 8 3 first = int(n / 2 - 1) # 3 4 for start in range(first, -1, -1): # 3~0 revese 5 max_... 阅读全文
posted @ 2015-05-06 11:44 sangocare 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1 import sys 2 3 4 def fact(n): 5 final = n 6 while n > 1: 7 final *= n - 1 8 n -= 1 9 return final #逻辑严谨,不要忘了return10 ... 阅读全文
posted @ 2015-05-06 09:12 sangocare 阅读(149) 评论(0) 推荐(0) 编辑
2015年5月5日
摘要: 1 import sys 2 3 4 def count_holes(letter): 5 hole_2 = ['A', 'D', 'O', 'P', 'Q', 'R'] 6 if letter == 'B': 7 return 2 8 elif let... 阅读全文
posted @ 2015-05-05 16:56 sangocare 阅读(166) 评论(0) 推荐(0) 编辑
2015年5月4日
摘要: 1 import sys 2 #import psyco #很奇怪,这题用psyco就runtime error 3 4 5 #psyco.full() 6 7 8 def z(n): #这个应该是技巧的一种算法 9 r = 010 while 5 <= n:11 ... 阅读全文
posted @ 2015-05-04 19:13 sangocare 阅读(170) 评论(0) 推荐(0) 编辑
2015年5月3日
摘要: import sysimport psyco #一键优化库psyco.full()def main(): n, k = map(int, sys.stdin.readline().strip().split()) #两位数输入的复用 count = 0 for t in sys.s... 阅读全文
posted @ 2015-05-03 18:43 sangocare 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 1 # ATM2 import sys3 4 withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结尾的\n符号5 6 if int(withdraw) % 5 != 0 or bala... 阅读全文
posted @ 2015-05-03 10:47 sangocare 阅读(168) 评论(0) 推荐(0) 编辑