結果

問題 No.156 キャンディー・ボックス
ユーザー togaerrortogaerror
提出日時 2015-03-13 02:49:51
言語 Perl
(5.38.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 327 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 5,144 KB
最終ジャッジ日時 2023-09-11 08:16:06
合計ジャッジ時間 1,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
4,900 KB
testcase_02 AC 5 ms
5,120 KB
testcase_03 AC 4 ms
5,100 KB
testcase_04 AC 5 ms
4,796 KB
testcase_05 AC 4 ms
4,900 KB
testcase_06 AC 5 ms
5,120 KB
testcase_07 AC 5 ms
5,112 KB
testcase_08 AC 5 ms
4,956 KB
testcase_09 AC 5 ms
5,032 KB
testcase_10 AC 5 ms
4,872 KB
testcase_11 AC 5 ms
4,900 KB
testcase_12 AC 4 ms
4,984 KB
testcase_13 AC 5 ms
5,108 KB
testcase_14 AC 5 ms
4,792 KB
testcase_15 AC 5 ms
5,028 KB
testcase_16 AC 5 ms
4,792 KB
testcase_17 AC 5 ms
5,052 KB
testcase_18 WA -
testcase_19 AC 4 ms
5,108 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 5 ms
4,980 KB
testcase_23 WA -
testcase_24 AC 5 ms
4,984 KB
testcase_25 AC 5 ms
4,904 KB
testcase_26 AC 5 ms
4,804 KB
testcase_27 AC 5 ms
4,868 KB
testcase_28 AC 5 ms
4,928 KB
testcase_29 AC 5 ms
4,952 KB
testcase_30 AC 4 ms
5,100 KB
testcase_31 AC 5 ms
4,896 KB
testcase_32 AC 5 ms
5,088 KB
testcase_33 AC 5 ms
4,988 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use strict;
use warnings;

my ($n, $m) = split / /, <>;
my $c = <>;
chomp $c;

my @array = split / /, $c;
@array = sort @array;
my $total = 0;

for(my $i = 0; $i < $n; $i++) {
	$total += $array[$i];
	if($total == $m) {
		print $i + 1 . "\n";
		last;
	} elsif($total > $m) {
		print "$i\n";
		last;
	}
}

exit;
0