結果

問題 No.1083 余りの余り
ユーザー neterukunneterukun
提出日時 2020-06-20 12:13:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 379 ms / 3,000 ms
コード長 288 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 82,524 KB
最終ジャッジ日時 2023-09-16 17:10:17
合計ジャッジ時間 6,151 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,228 KB
testcase_01 AC 74 ms
71,052 KB
testcase_02 AC 74 ms
71,292 KB
testcase_03 AC 74 ms
71,460 KB
testcase_04 AC 76 ms
71,388 KB
testcase_05 AC 192 ms
79,760 KB
testcase_06 AC 73 ms
71,280 KB
testcase_07 AC 73 ms
71,440 KB
testcase_08 AC 75 ms
71,396 KB
testcase_09 AC 76 ms
71,512 KB
testcase_10 AC 73 ms
71,272 KB
testcase_11 AC 76 ms
71,624 KB
testcase_12 AC 74 ms
71,584 KB
testcase_13 AC 74 ms
71,436 KB
testcase_14 AC 73 ms
71,280 KB
testcase_15 AC 73 ms
71,540 KB
testcase_16 AC 74 ms
71,052 KB
testcase_17 AC 74 ms
71,508 KB
testcase_18 AC 241 ms
80,908 KB
testcase_19 AC 187 ms
80,180 KB
testcase_20 AC 89 ms
76,596 KB
testcase_21 AC 126 ms
79,072 KB
testcase_22 AC 72 ms
71,296 KB
testcase_23 AC 299 ms
81,076 KB
testcase_24 AC 312 ms
82,108 KB
testcase_25 AC 288 ms
81,336 KB
testcase_26 AC 307 ms
82,524 KB
testcase_27 AC 75 ms
71,272 KB
testcase_28 AC 322 ms
81,836 KB
testcase_29 AC 72 ms
71,052 KB
testcase_30 AC 74 ms
71,288 KB
testcase_31 AC 73 ms
71,292 KB
testcase_32 AC 76 ms
71,488 KB
testcase_33 AC 379 ms
81,972 KB
権限があれば一括ダウンロードができます

ソースコード

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