2017年7月28日
摘要: n= int (raw_input())def find_prime(n): L = list(range(2,n + 1)) m = 0 while m < len(L): n = m + 1 while n < len(L): if L[n]%L[m] == 0: del L[n] n = n 阅读全文
posted @ 2017-07-28 18:27 乾元东 阅读(1435) 评论(0) 推荐(0) 编辑
摘要: 考拉兹猜想是1927年提出的猜想,至今仍然未解。考拉兹猜想的内容是:对于每一个正整数,如果他是奇数,则对它乘3再加1,如果它是偶数,则对他除2,。这样循环,最终结果都能得到1 n=int (raw_input()) while n!=1: if n%2==0: n/=2 else: n=3*n+1 阅读全文
posted @ 2017-07-28 13:48 乾元东 阅读(918) 评论(0) 推荐(0) 编辑
摘要: import matha = float (raw_input())b = float (raw_input())c = float (raw_input())tt = (a**2+b**2-c**2)/(2*a*b)print '%.1f' % (180/math.pi * math.acos(t 阅读全文
posted @ 2017-07-28 11:24 乾元东 阅读(4222) 评论(0) 推荐(0) 编辑
摘要: s = int (raw_input())if s/60==0: print '0' , '0' , selif s/60/60==0: print '0' , s/60 , s%60else: a=s/60/60 print a , (s-a*60*60)/60 , (s-a*60*60)%60 阅读全文
posted @ 2017-07-28 11:23 乾元东 阅读(789) 评论(0) 推荐(0) 编辑
摘要: 乱码原因:源码文件的编码格式为utf-8,但是window的本地默认编码是gbk,所以在控制台直接打印utf-8的字符串当然是乱码了! 解决方法:1、print mystr.decode('utf-8').encode('gbk')2、比较通用的方法: 复制代码代码如下: import systyp 阅读全文
posted @ 2017-07-28 11:20 乾元东 阅读(260) 评论(0) 推荐(0) 编辑
摘要: import mathwhile True: a = float (raw_input('input a:')) b = float (raw_input('input b:')) c = float (raw_input('input c:')) if a!=0: delta=b**2-4*a*c 阅读全文
posted @ 2017-07-28 11:19 乾元东 阅读(173) 评论(0) 推荐(0) 编辑