結果

問題 No.1083 余りの余り
ユーザー FromBooskaFromBooska
提出日時 2023-02-14 14:07:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 71,600 KB
最終ジャッジ日時 2023-09-24 03:36:40
合計ジャッジ時間 6,241 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,064 KB
testcase_01 AC 70 ms
71,044 KB
testcase_02 AC 71 ms
70,952 KB
testcase_03 AC 72 ms
71,220 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 71 ms
71,212 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 69 ms
71,492 KB
testcase_10 AC 69 ms
70,956 KB
testcase_11 WA -
testcase_12 AC 69 ms
71,372 KB
testcase_13 WA -
testcase_14 AC 68 ms
71,092 KB
testcase_15 AC 69 ms
70,956 KB
testcase_16 AC 68 ms
71,476 KB
testcase_17 AC 69 ms
71,100 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 71 ms
71,168 KB
testcase_22 AC 71 ms
71,256 KB
testcase_23 AC 71 ms
71,088 KB
testcase_24 WA -
testcase_25 AC 70 ms
71,344 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 70 ms
71,216 KB
testcase_30 AC 70 ms
71,476 KB
testcase_31 AC 68 ms
71,476 KB
testcase_32 AC 69 ms
71,340 KB
testcase_33 AC 69 ms
71,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 可能性があるのはAの最小値未満の整数値
# 解決め打ち二分探索はダメだ
# Nは小さいのでビット全探索など使えるか?
# Kがaの倍数なら0, gcd!=1ならどうなる
# Aの最小値未満の整数値で一番大きい数字になるmodで最初に割る、それがキープされる

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

A_min = min(A)
mx = 0
for i in range(N):
    calc = K%A[i]
    if calc < A_min:
        mx = max(mx, calc)
print(mx)

0