結果

問題 No.1083 余りの余り
ユーザー chineristACchineristAC
提出日時 2020-06-19 21:57:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 3,000 ms
コード長 246 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 76,112 KB
最終ジャッジ日時 2024-07-03 14:27:22
合計ジャッジ時間 3,585 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))

A.sort()

ans=-1

for i in range(2**(N-1)):
    test=K
    for j in range(N-2,-1,-1):
        if i>>j &1==1:
            test%=A[j+1]
    test%=A[0]
    ans=max(ans,test)

print(ans)
0