You are viewing a single comment's thread. Return to all comments →
100 points/- python3
from math import comb data=input().split() n=int(data[0]) k=int(data[1]) count=0 for i in range(2,n+1): r=(i+1)//2 if comb(i,r)>k: if i%2==0: count+=1 r=r-1 else: count+=2 r=r-2 while comb(i,r)>k: count+=2 r+=-1 if r<0: break print(count)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #53: Combinatoric selections
You are viewing a single comment's thread. Return to all comments →
100 points/- python3