結果

問題 No.1083 余りの余り
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-15 11:31:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 3,000 ms
コード長 455 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 77,116 KB
最終ジャッジ日時 2023-08-27 02:03:22
合計ジャッジ時間 6,516 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,232 KB
testcase_01 AC 69 ms
71,488 KB
testcase_02 AC 68 ms
71,128 KB
testcase_03 AC 67 ms
71,468 KB
testcase_04 AC 72 ms
76,464 KB
testcase_05 AC 113 ms
76,312 KB
testcase_06 AC 65 ms
71,268 KB
testcase_07 AC 68 ms
76,396 KB
testcase_08 AC 65 ms
71,320 KB
testcase_09 AC 64 ms
71,404 KB
testcase_10 AC 65 ms
71,240 KB
testcase_11 AC 70 ms
76,308 KB
testcase_12 AC 67 ms
71,240 KB
testcase_13 AC 64 ms
71,404 KB
testcase_14 AC 66 ms
71,412 KB
testcase_15 AC 63 ms
71,228 KB
testcase_16 AC 66 ms
71,420 KB
testcase_17 AC 65 ms
71,480 KB
testcase_18 AC 142 ms
76,404 KB
testcase_19 AC 108 ms
76,608 KB
testcase_20 AC 73 ms
76,568 KB
testcase_21 AC 78 ms
76,524 KB
testcase_22 AC 69 ms
71,380 KB
testcase_23 AC 224 ms
76,848 KB
testcase_24 AC 223 ms
76,864 KB
testcase_25 AC 227 ms
76,940 KB
testcase_26 AC 228 ms
77,096 KB
testcase_27 AC 66 ms
71,312 KB
testcase_28 AC 219 ms
77,116 KB
testcase_29 AC 62 ms
71,416 KB
testcase_30 AC 64 ms
71,248 KB
testcase_31 AC 62 ms
71,096 KB
testcase_32 AC 62 ms
71,404 KB
testcase_33 AC 218 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=list(map(int,input().split()))
"""
答えはmin(a)未満になる。
上限はmin(a)-1
k<min(a)になった瞬間どんな操作をしてもkは不変。
a=[17,13,10,5]
処理順ai,ajがあるとき、ai<ajならやる意味がない。aiのみ行う場合と同じ。
"""
ans=0
a.sort(reverse=True)
for i in range(1<<(n-1)):
	now=k
	for j in range(n-1):
		if (i>>j)&1:
			now%=a[j]
	now%=a[-1]
	ans=max(ans,now)
print(ans)
0