結果

問題 No.5 数字のブロック
ユーザー togaerrortogaerror
提出日時 2015-04-07 00:50:34
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 281 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 6,224 KB
最終ジャッジ日時 2023-09-17 06:21:31
合計ジャッジ時間 1,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,088 KB
testcase_01 AC 5 ms
4,900 KB
testcase_02 WA -
testcase_03 AC 7 ms
5,608 KB
testcase_04 AC 7 ms
5,360 KB
testcase_05 WA -
testcase_06 AC 7 ms
5,644 KB
testcase_07 AC 7 ms
5,472 KB
testcase_08 AC 8 ms
5,500 KB
testcase_09 AC 5 ms
5,148 KB
testcase_10 AC 10 ms
6,000 KB
testcase_11 AC 6 ms
5,220 KB
testcase_12 AC 9 ms
5,676 KB
testcase_13 AC 9 ms
5,788 KB
testcase_14 AC 4 ms
5,020 KB
testcase_15 WA -
testcase_16 AC 10 ms
5,848 KB
testcase_17 AC 10 ms
6,076 KB
testcase_18 AC 10 ms
5,928 KB
testcase_19 AC 11 ms
6,224 KB
testcase_20 AC 4 ms
4,844 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 4 ms
4,764 KB
testcase_24 AC 4 ms
5,096 KB
testcase_25 AC 5 ms
4,808 KB
testcase_26 AC 4 ms
5,068 KB
testcase_27 AC 4 ms
5,072 KB
testcase_28 AC 4 ms
4,984 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 4 ms
4,796 KB
testcase_32 AC 4 ms
5,052 KB
testcase_33 AC 4 ms
4,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use warnings;

my $l = <>;
my $n =<>;
my $str = <>;
chomp $str;
my @array = split / /, $str;
my $ans = 0;
my $count = 0;
@array = sort {$a <=> $b} @array;

for(my $i = 0; $i < $n; $i++) {
	$count += $array[$i];
	if($count < $l) {
		$ans++;
	} else {
		last;
	}
}

print "$ans\n";

0