結果

問題 No.143 豆
ユーザー PcclaPccla
提出日時 2017-07-15 14:50:17
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 32,656 KB
最終ジャッジ日時 2024-04-16 21:47:08
合計ジャッジ時間 3,051 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

<?php

fscanf(STDIN, "%d %d %d", $k, $n, $f);
$age = explode(" ", trim(fgets(STDIN)));

// 豆の合計個数
$total_beans = $k * $n;

for($i = 0; $i < $f; $i++)
{
	$nokori = $total_beans - $age[$i];
	$total_beans = $nokori;
	if ($nokori < 1)
	{
		echo -1;
	}
}
echo $total_beans."\n";
0