Created
August 17, 2020 09:55
-
-
Save Svastikkka/32e802541a0218c2a23b54ff9a4d9689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t=int(input()) | |
for i in range(t): | |
n,k=map(int,input().split()) | |
arr=list(map(int,input().split())) | |
res=sorted(arr) | |
largest_divisor=0 | |
for i in res: | |
# 3 | |
if k % i == 0: | |
# 4 | |
largest_divisor = i | |
if largest_divisor in arr: | |
print(largest_divisor) | |
else: | |
print(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chef and Linear Chess Problem Code: LINCHESS