結果

問題 No.521 Cheeses and a Mousetrap(チーズとネズミ捕り)
ユーザー papinianuspapinianus
提出日時 2017-07-26 11:59:22
言語 PHP
(8.3.4)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 30,796 KB
実行使用メモリ 31,364 KB
最終ジャッジ日時 2024-04-17 23:54:15
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
30,852 KB
testcase_01 AC 46 ms
31,364 KB
testcase_02 AC 42 ms
31,004 KB
testcase_03 AC 41 ms
31,044 KB
testcase_04 AC 42 ms
31,108 KB
testcase_05 AC 41 ms
30,904 KB
testcase_06 AC 44 ms
31,252 KB
testcase_07 AC 41 ms
30,932 KB
testcase_08 AC 42 ms
30,976 KB
testcase_09 AC 41 ms
31,000 KB
testcase_10 AC 42 ms
31,160 KB
testcase_11 AC 41 ms
30,888 KB
testcase_12 AC 44 ms
31,252 KB
testcase_13 AC 41 ms
31,152 KB
testcase_14 AC 41 ms
31,060 KB
testcase_15 AC 41 ms
31,188 KB
testcase_16 AC 41 ms
31,028 KB
testcase_17 AC 41 ms
31,220 KB
testcase_18 AC 42 ms
31,184 KB
testcase_19 AC 41 ms
30,956 KB
testcase_20 AC 42 ms
31,056 KB
testcase_21 AC 41 ms
31,068 KB
testcase_22 AC 44 ms
30,916 KB
testcase_23 AC 42 ms
31,068 KB
testcase_24 AC 42 ms
31,036 KB
testcase_25 AC 41 ms
31,116 KB
testcase_26 AC 42 ms
30,824 KB
testcase_27 AC 42 ms
31,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($n, $k) = explode(" ", trim(fgets(STDIN)));
if($k == 0 || $k > $n) {
    echo "0".PHP_EOL;
    exit;
}
if(($n % 2) == 0) {
    echo ($n-2).PHP_EOL;
    exit;
}
if($k == ($n + 1) / 2) {
    echo ($n-1).PHP_EOL;
    exit;
}
echo ($n-2).PHP_EOL;
0