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) % 2 == 0: print int(num) else: # 千万不要忘了考虑奇数的情况 print int(num) -1 main() 学习 化繁为简 逻辑上的理解正确和化繁为简,是刷OJ的第一步,比如本题,一堆废话,其实水爆 输入缓冲流 stdin这种输入就是缓冲流的使用 判断奇偶 模…
import sys #import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法 r = 0 while 5 <= n: n /= 5 r += n return r def main(): n = int(sys.stdin.readline()) for t in sys.stdin: #这种循环输入一点问题也没 print z(int(t)) #输入的是String, 一定要记得int转化…
# 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(…
import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了return def main(): t = int(sys.stdin.readline()) for n in sys.stdin: print fact(int(n)) #读取String的转换是一个常见的坑 main() //第二种,利用现成的库 from math import factorial #熟悉…
import sys import psyco #一键优化库 psyco.full() def main(): n, k = map(int, sys.stdin.readline().strip().split()) #两位数输入的复用 count = 0 for t in sys.stdin: #注意这个for循环方式 if int(t) % k == 0: count += 1 print '%d' % count #注意格式输出 main() #写成函数的格式是一个良好的习惯 学到 py…
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (which contains strings) to unmanaged code. The structure was passed as an "in" (by-value) parameter, i.e. the structure was passed to the unmanage…
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (which contains strings) to unmanaged code. The structure was passed as an "in" (by-value) parameter, i.e. the structure was passed to the unmanage…
Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his dishes. As you might know, cooking is not an easy job at all and cooking everyday makes the chef very tired. So, Chef has decided to give himself some…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5923 题意: 现有 $N$ 支队伍参加比赛,只有一个队伍能获胜.给出每个队伍一个赔率 $A_i:B_i$,你往这个队投 $x$ 元,若该队获胜你可得到 $\frac{A_i+…
题意:2个人从1走到n,假设一条路第一次走则是价值di,假设第二次还走这条路则须要价值di+ai,要你输出2个人到达终点的最小价值! 太水了!一条边建2次就OK了.第一次价值为di,第二次为ai+di,加入源点汇点跑最小费用最大流就OK了! AC代码: #include<iostream> #include<string> #include<algorithm> #include<cstdlib> #include<cstdio> #includ…