結果

問題 No.1083 余りの余り
ユーザー neterukun
提出日時 2020-06-20 12:13:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 321 ms / 3,000 ms
コード長 288 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 77,972 KB
最終ジャッジ日時 2024-07-03 17:04:39
合計ジャッジ時間 4,310 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(i, x):
    res = 0
    if i == n:
        return x
    for j in range(i + 1, n + 1):
        tmp = x % a[j]
        res = max(res, dfs(j, tmp))
    return res

n, k = map(int, input().split())
a = list(map(int, input().split()))

a = [0] + sorted(a, reverse=True)
print(dfs(0, k))
0