結果
| 問題 | No.1083 余りの余り | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-06-24 13:24:58 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2,303 ms / 3,000 ms | 
| コード長 | 282 bytes | 
| コンパイル時間 | 238 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-11-08 05:43:06 | 
| 合計ジャッジ時間 | 17,368 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 | 
ソースコード
from itertools import product
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for bit in product(range(2),repeat=n-1):
    tmp=k
    for i in range(n-1):
        if bit[i]:
            tmp%=a[i]
    tmp%=a[-1]
    ans=max(ans,tmp)
print(ans)
            
            
            
        