1 |
1921 1 куча def f(s,c,m): if s>=34: return c%2==m%2 if c==m: return 0 h=[f(s+1,c+1,m), f(s+2,c+1,m), f(s+3,c+1,m), f(s*2,c+1,m)] return any(h) if (c+1)%2==m%2 else all(h) for s in range(1,33): for m in range(1,15): if f(s,0,m)==234: print(s,m) break 2 кучиdef f(a,b,c,m): if a+b>=235: return c%2==m%2 if c==m: return 0 h=[f(a+1,b,c+1,m),f(a,b+1,c+1,m), f(a*2,b,c+1,m),f(a,b*2,c+1,m)] return any(h) if (c+1)%2==m%2 else any(h) for b in range(1,218): for m in range(1,5): if f(17,b,0,m)==1: if m==2: print(b,m) break 17 a=[int(x) for x in open("17.txt")] print(a) b=[] for i in range(len(a)): if (a[i]%10==2 or a[i]%10==7) and a[i]%3==0 and a[i]%11==0: b.append(a[i]) print(len(b),min(b)) 2 from itertools import * print('W X Y Z') for w, x, y, z in product([0, 1], repeat=4): f = (x and (not y) or (x == z) or w) if f == 0: print(w, x, y, z) |
Комментарии