結果

問題 No.5 数字のブロック
ユーザー Vin
提出日時 2022-11-15 09:59:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 222 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-09-16 10:20:25
合計ジャッジ時間 2,112 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == "__main__":
	L = int(input())
	N = int(input())
	W = sorted(list(map(int, input().split())))
	
	count = 0
	sum = 0
	
	for i in W:
		count += 1
		sum += i
		if sum > L:
			count -= 1
			break
		
	print(count)
0