結果

問題 No.5 数字のブロック
ユーザー dashi_dragonsdashi_dragons
提出日時 2017-02-10 16:55:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 8,896 KB
最終ジャッジ日時 2023-08-27 06:53:02
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,744 KB
testcase_01 AC 16 ms
7,760 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 21 ms
8,588 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 19 ms
8,444 KB
testcase_08 WA -
testcase_09 AC 17 ms
8,124 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 21 ms
8,488 KB
testcase_13 WA -
testcase_14 AC 17 ms
7,696 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 24 ms
8,884 KB
testcase_20 AC 16 ms
7,880 KB
testcase_21 AC 16 ms
7,712 KB
testcase_22 AC 16 ms
7,748 KB
testcase_23 AC 16 ms
7,760 KB
testcase_24 AC 16 ms
7,760 KB
testcase_25 AC 16 ms
7,760 KB
testcase_26 AC 15 ms
7,744 KB
testcase_27 AC 16 ms
7,712 KB
testcase_28 AC 16 ms
7,784 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 16 ms
7,692 KB
testcase_32 AC 15 ms
7,800 KB
testcase_33 AC 15 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def check_range(a,b,x):
	if a > x or b < x:
		sys.exit()

def check_eq(a,b):
	if a != b:
		sys.exit()

L = int(input())
check_range(1,10000,L)

N = int(input())
check_range(1,10000,N)

data = input().split(' ')
check_eq(len(data),N)

for i in range(0,N):
	data[i] = int(data[i])
	check_range(1,L,N)

size = 0
cnt = 0
data.sort()

for i in range(0,N):
	if data[i] + size <= L:
		cnt += 1
		size += data[i]		
	else:
		break

print(cnt)
0