結果

問題 No.143 豆
ユーザー PcclaPccla
提出日時 2017-07-15 15:08:29
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 30,696 KB
実行使用メモリ 31,436 KB
最終ジャッジ日時 2024-04-16 21:47:24
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
30,760 KB
testcase_01 AC 59 ms
31,104 KB
testcase_02 AC 42 ms
31,220 KB
testcase_03 AC 42 ms
31,308 KB
testcase_04 AC 42 ms
30,916 KB
testcase_05 AC 41 ms
31,400 KB
testcase_06 AC 42 ms
31,300 KB
testcase_07 AC 42 ms
31,176 KB
testcase_08 AC 40 ms
31,100 KB
testcase_09 WA -
testcase_10 AC 41 ms
31,024 KB
testcase_11 AC 42 ms
31,036 KB
testcase_12 AC 41 ms
30,996 KB
testcase_13 AC 41 ms
31,152 KB
testcase_14 AC 41 ms
31,216 KB
testcase_15 AC 41 ms
30,992 KB
testcase_16 AC 41 ms
31,236 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;
                exit;
	}
}
echo $total_beans."\n";
0