Sort 15 Discussions, By:
Please Login in order to post a comment
can anyone explain me the question
I tried a recursion logic .I get the 1111 and 3 other test cases right. All others are incorrect.
a = [15, 10, 8, 50]
I get 14178352532007. Can someone help validate if this is correct/high/low when compared to actual answer
I don't understand. The example is working fine, but all of the other tests fails when I submit. What am I missing?
from itertools import product
n1, n2, n3, n4 = map(int,input().split())
for i in range (n2):
for i in product(l, repeat= n1):
if (sum(sorted(i, reverse= True) [:n3]) == n4):
Is it guranteed to be resolved in slow Python?
See code below
string = input()
n, d, m, s = tuple(map(int, string.split()))
x = [l for l in range(1,d+1)]
m = m * (-1) - 1
z = [p for p in itertools.product(x, repeat=n) if sum(sorted(p)[:m:-1]) == s]
print(len(z) % (10**9+7))