結果

問題 No.143 豆
ユーザー jake_tarojake_taro
提出日時 2015-09-07 14:40:20
言語 PHP
(8.2.11)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 355 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 18,504 KB
実行使用メモリ 18,940 KB
最終ジャッジ日時 2023-09-30 16:37:34
合計ジャッジ時間 1,891 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,752 KB
testcase_01 AC 16 ms
18,848 KB
testcase_02 AC 16 ms
18,764 KB
testcase_03 AC 16 ms
18,884 KB
testcase_04 AC 15 ms
18,860 KB
testcase_05 AC 16 ms
18,852 KB
testcase_06 AC 16 ms
18,892 KB
testcase_07 AC 15 ms
18,940 KB
testcase_08 AC 16 ms
18,792 KB
testcase_09 AC 17 ms
18,828 KB
testcase_10 AC 16 ms
18,744 KB
testcase_11 AC 15 ms
18,844 KB
testcase_12 AC 16 ms
18,832 KB
testcase_13 AC 16 ms
18,928 KB
testcase_14 AC 15 ms
18,872 KB
testcase_15 AC 16 ms
18,856 KB
testcase_16 AC 16 ms
18,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$input = explode(" ", trim(fgets(STDIN)));
$A = explode(" ", trim(fgets(STDIN)));

$K = $input[0];
$N = $input[1];
$F = $input[2];

//豆の数
$number = $K * $N;
//すべての年齢の和
$wa = 0;
for($i = 0; $i < $F; $i++){
	$wa += $A[$i];
}
$diff = $number - $wa;
if($diff >= 0){
	echo $diff, PHP_EOL;
}else if($diff < 0){
	echo -1, PHP_EOL;
}
0