結果

問題 No.1986 Yummy
ユーザー SKSK
提出日時 2022-12-20 17:19:49
言語 PHP
(8.3.4)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 32,404 KB
実行使用メモリ 39,216 KB
最終ジャッジ日時 2024-04-29 02:52:07
合計ジャッジ時間 3,717 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
36,540 KB
testcase_01 AC 47 ms
30,968 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$n = trim(fgets(STDIN));
$a =0;
$b= 0;

if($n % 2 == 1){
    $candy = 2;
}else{
    $candy = 1;
}

for($i = 1; $i <= $n;$i++){
    if($i % 2 ==1 && $candy > 0){
        $a++;
        $candy--;
    }elseif($i % 2 == 0 && $candy > 0){
        $b++;
        $candy--;
    }elseif($candy == 0){
        $candy++;
    }
}

echo $a;
?>
0