結果

問題 No.143 豆
ユーザー
提出日時 2016-01-18 21:58:37
言語 PHP
(8.3.4)
結果
AC  
実行時間 18 ms / 1,000 ms
コード長 304 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 18,840 KB
実行使用メモリ 18,924 KB
最終ジャッジ日時 2023-09-30 16:41:14
合計ジャッジ時間 1,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
18,732 KB
testcase_01 AC 16 ms
18,744 KB
testcase_02 AC 17 ms
18,832 KB
testcase_03 AC 17 ms
18,796 KB
testcase_04 AC 18 ms
18,740 KB
testcase_05 AC 16 ms
18,820 KB
testcase_06 AC 17 ms
18,828 KB
testcase_07 AC 16 ms
18,732 KB
testcase_08 AC 17 ms
18,564 KB
testcase_09 AC 17 ms
18,720 KB
testcase_10 AC 16 ms
18,752 KB
testcase_11 AC 16 ms
18,924 KB
testcase_12 AC 16 ms
18,800 KB
testcase_13 AC 16 ms
18,784 KB
testcase_14 AC 16 ms
18,580 KB
testcase_15 AC 17 ms
18,748 KB
testcase_16 AC 16 ms
18,744 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$input1 = trim(fgets(STDIN));

list($pax, $bag, $fam) = explode(" ", $input1);

$input2 = trim(fgets(STDIN));

$famAge = explode(" ", $input2);

$ageSom = array_sum($famAge);

$paxBag = $pax * $bag;

$answer = $paxBag - $ageSom;

if($answer < 0){
    echo -1;
}else{
    echo $paxBag - $ageSom;
}
0