結果

問題 No.143 豆
ユーザー shiCanoko_oshiCanoko_o
提出日時 2019-05-18 23:13:36
言語 Perl
(5.38.2)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 359 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 4,692 KB
最終ジャッジ日時 2023-09-30 17:33:23
合計ジャッジ時間 983 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,440 KB
testcase_01 AC 3 ms
4,432 KB
testcase_02 AC 3 ms
4,608 KB
testcase_03 AC 2 ms
4,532 KB
testcase_04 AC 3 ms
4,616 KB
testcase_05 AC 2 ms
4,556 KB
testcase_06 AC 3 ms
4,588 KB
testcase_07 AC 2 ms
4,616 KB
testcase_08 AC 2 ms
4,592 KB
testcase_09 AC 3 ms
4,512 KB
testcase_10 AC 2 ms
4,616 KB
testcase_11 AC 2 ms
4,556 KB
testcase_12 AC 2 ms
4,692 KB
testcase_13 AC 2 ms
4,556 KB
testcase_14 AC 3 ms
4,644 KB
testcase_15 AC 3 ms
4,428 KB
testcase_16 AC 3 ms
4,552 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

my $num1 = <>;
my $num2 = <>;
chomp ($num1, $num2);

my ($beans, $bags, $people) = split (/ /, $num1);
my @num2 = split (/ /, $num2);

my $total_beans = $beans * $bags;

my $sum_age;

for my $age(@num2){
    $sum_age += $age;
}

if($total_beans - $sum_age < 0){
    print "-1\n";
}else{
    my $remainder = $total_beans - $sum_age;
    print "$remainder\n";
}
0