We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- HourRank 24
- Mutual Indivisibility
- Discussions
Mutual Indivisibility
Mutual Indivisibility
Sort by
recency
|
13 Discussions
|
Please Login in order to post a comment
Why set [3,4,5] is not accepted as avalid output when it was clearly mentioned it is also one of the valid output in explanation.
I didn't expect but following program works. -_-b
After multiple attempts, got this working in java.
why this solution isnt valid (it gave me same out put as cases but the site give me time error )? t= int(input().strip()) l=[] for a0 in range(t): a, b, x = input().strip().split(' ') a, b, x = [int(a), int(b), int(x)] xx=list(range(int(a),int(b)+1)) n=int(x) xxx=list(reversed(xx)) for x0 in xxx : y=[x0] for x1 in xxx : for y0 in y: if x1 % y0 !=0 and y0 %x1 !=0 : z = 1 else: z=2 break if z ==1: y.append(x1) if len(y)== n: break if len(y)== n: l.append(y) break elif len(y) != n and xxx.index(x0) for l0 in l: if type(l0)==type([]): for x0 in l0: z.append(str(x0)) print(" ".join(z)) z.clear() else: print(l0)