結果

問題 No.143 豆
ユーザー PcclaPccla
提出日時 2017-07-15 15:11:35
言語 PHP
(8.3.4)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 307 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 18,680 KB
実行使用メモリ 19,036 KB
最終ジャッジ日時 2023-09-30 17:04:35
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,904 KB
testcase_01 AC 16 ms
18,952 KB
testcase_02 AC 15 ms
18,952 KB
testcase_03 AC 15 ms
18,940 KB
testcase_04 AC 15 ms
18,900 KB
testcase_05 AC 15 ms
18,888 KB
testcase_06 AC 15 ms
18,888 KB
testcase_07 AC 15 ms
19,036 KB
testcase_08 AC 15 ms
18,984 KB
testcase_09 AC 15 ms
18,964 KB
testcase_10 AC 16 ms
18,952 KB
testcase_11 AC 15 ms
18,912 KB
testcase_12 AC 15 ms
18,948 KB
testcase_13 AC 15 ms
18,924 KB
testcase_14 AC 15 ms
18,876 KB
testcase_15 AC 15 ms
18,892 KB
testcase_16 AC 15 ms
18,864 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 < 0)
	{
		echo -1;
                exit;
	}
}
echo $total_beans."\n";
0