結果

問題 No.5 数字のブロック
ユーザー dashi_dragonsdashi_dragons
提出日時 2017-02-10 17:02:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 9,076 KB
最終ジャッジ日時 2023-08-27 06:53:04
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,784 KB
testcase_01 AC 17 ms
7,708 KB
testcase_02 AC 16 ms
7,712 KB
testcase_03 AC 20 ms
8,712 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 18 ms
8,528 KB
testcase_08 WA -
testcase_09 AC 17 ms
8,368 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 19 ms
8,656 KB
testcase_13 WA -
testcase_14 AC 14 ms
7,784 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 23 ms
9,076 KB
testcase_20 AC 15 ms
7,768 KB
testcase_21 AC 15 ms
7,896 KB
testcase_22 AC 15 ms
7,832 KB
testcase_23 AC 16 ms
7,920 KB
testcase_24 AC 15 ms
7,900 KB
testcase_25 AC 15 ms
7,872 KB
testcase_26 AC 15 ms
7,792 KB
testcase_27 AC 14 ms
7,928 KB
testcase_28 AC 14 ms
7,768 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 14 ms
7,928 KB
testcase_32 AC 15 ms
7,820 KB
testcase_33 AC 14 ms
7,792 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 = sorted(data)

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

print(cnt)


0