結果

問題 No.143 豆
ユーザー Kentaro YanoKentaro Yano
提出日時 2021-03-29 18:11:10
言語 PHP
(8.3.4)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 423 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 18,648 KB
実行使用メモリ 19,028 KB
最終ジャッジ日時 2023-08-19 16:32:05
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
19,004 KB
testcase_01 AC 16 ms
18,924 KB
testcase_02 AC 16 ms
19,004 KB
testcase_03 AC 16 ms
18,948 KB
testcase_04 AC 16 ms
18,956 KB
testcase_05 AC 16 ms
18,936 KB
testcase_06 AC 17 ms
18,844 KB
testcase_07 AC 16 ms
19,024 KB
testcase_08 AC 16 ms
18,988 KB
testcase_09 AC 16 ms
18,804 KB
testcase_10 AC 16 ms
19,028 KB
testcase_11 AC 16 ms
18,900 KB
testcase_12 AC 15 ms
18,972 KB
testcase_13 AC 16 ms
18,948 KB
testcase_14 AC 16 ms
18,892 KB
testcase_15 AC 15 ms
18,988 KB
testcase_16 AC 15 ms
18,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    while($line = fgets(STDIN)){
        $tmp[] = $line;
    }
    
    foreach($tmp as $val){
        $array[] = explode(" ", $val);
    }
    
    // $array[0]は粒、袋、人数
    // $array[1]は 年齢
    $sum = $array[0][0] * $array[0][1];
    
    for($i=0; $i<$array[0][2]; $i++){
        $sum -= $array[1][$i];
    }
    
    if($sum >= 0){
         echo $sum;
    }else{
        echo -1;
    }
   
?>
0