結果

問題 No.143 豆
ユーザー ant2357ant2357
提出日時 2016-03-28 22:16:12
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 32,532 KB
最終ジャッジ日時 2024-04-10 05:14:03
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
32,272 KB
testcase_01 AC 43 ms
32,276 KB
testcase_02 AC 42 ms
32,400 KB
testcase_03 AC 41 ms
32,400 KB
testcase_04 AC 41 ms
32,272 KB
testcase_05 AC 40 ms
32,272 KB
testcase_06 AC 40 ms
32,272 KB
testcase_07 AC 40 ms
32,400 KB
testcase_08 AC 42 ms
32,272 KB
testcase_09 WA -
testcase_10 AC 41 ms
32,272 KB
testcase_11 AC 44 ms
32,400 KB
testcase_12 AC 41 ms
32,400 KB
testcase_13 AC 41 ms
32,272 KB
testcase_14 AC 40 ms
32,212 KB
testcase_15 AC 41 ms
32,276 KB
testcase_16 AC 40 ms
32,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
//$k: 豆の数
//$n: 袋の数
//$f: 何人家族か
list($k, $n, $f) = explode(" ", trim(fgets(STDIN)));

//歳
$a = explode(" ", trim(fgets(STDIN)));

//豆の総数
$beanTotal = $k * $n;

//食べる豆の合計値
$eatBeanSum = array_sum($a);

$ans = $beanTotal - $eatBeanSum;

if ($ans <= 0) {
	$ans = -1;
}

echo($ans.PHP_EOL);
0