結果

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

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for b in range(1, 1<<n):
    res = k
    for i in range(n-1):
        if (b>>i) & 1:
            res %= a[i]
    ans = max(ans, res%a[n-1])
print(ans)
0