摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- def ntom(x,size,mod): t=[0]*(size) j=0 while x and j1 a和d不能一起去 a+d!=2 a,e,f三人里要去两人 a+e+f==2 b和c都去 或者 都不去 (b+c==0 or b+c==2) c和d两人中只去一个 c+d=... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- def gcd(x,y): #最大公因子 if x>y:x%=y while x: x,y=y%x,x return y def lcm(x,y): #最小公倍数 return x*y/gcd(x,y) def jhua(x): t=gcd(... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- from collections import deque from math import log10 def permute(seq, index): seqc = seq[:] seqn = [seqc.pop()] divider = 2 while seqc: inde... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- from collections import deque def z69(): '''猜牌术(1) 魔术师,最上面一张是黑a,第2次从上到下数2张放在最 底下,然后翻开是黑k,然后再从上到下数3张放 在最底下,是黑q,第k次数k张,依次翻开,得 到黑a~1;问原始的牌序''' ss=13 ... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- from math import sqrt import random def daoxu(n): d=n s=0 while d!=0: d,f=divmod(d,10) s=f+s*10 return s def z85(): #任意取一个十进制数如12... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- def z94(): #斐波那契数列 def filie(x): a,b,t=1,1,0 if x==1 or x==2:return 1 while t!=x-2: a,b,t=b,a+b,t+1 retur... 阅读全文
摘要:
#!/usr/bin/python # -*- coding: utf-8 -*- from random import shuffle class caigame: win=False flag=False life=12 what=-1 s1='' map1=[] thenum=0 def start(self): ... 阅读全文
摘要:
from math import sqrt from datetime import date def k1(): #某人是1999年9月29日生日 #问到2006年9月29日他活了多少天 a=date(1999,9,29) b=date(2006,9,29) c=str(b-a).split(" ") print int(c[0]) ... 阅读全文