算法oj
五岁就抬头
这个作者很懒,什么都没留下…
展开
-
计算文件的26个字母出现的频率
来自solelearn appdef count_char(text,char): count = 0 for c in text: if c==char: count+=1 return countfimename = input("Enter a filename:")with open(fimename) as f: ...原创 2018-04-11 12:58:02 · 2283 阅读 · 0 评论 -
python 求素数
def get_primes(): num=2 while True: if is_prime(num): #暂未实现 yield num num+=1原创 2018-04-11 13:41:31 · 484 阅读 · 0 评论 -
A+B for Input-Output Practice (IV)
地址 http://acm.hdu.edu.cn/showproblem.php?pid=1092Problem DescriptionYour task is to Calculate the sum of some integers. InputInput contains multiple test cases. Each test case contains a integer N, an...原创 2018-04-18 09:45:44 · 410 阅读 · 0 评论 -
Number Sequence
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Sample Input1 1 31 2 100 0 0Sample Output25http://acm.hdu.edu.cn/showproblem.php?pid=1005f(n-1): 0~7,f(n): 0~7 所以共49种组合f(n) = (A * f(...原创 2018-04-26 10:45:05 · 155 阅读 · 0 评论