結果

問題 No.63 ポッキーゲーム
ユーザー ayaaya
提出日時 2019-07-25 14:38:36
言語 PHP
(8.3.4)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 1,177 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 18,632 KB
実行使用メモリ 18,860 KB
最終ジャッジ日時 2023-09-14 23:48:29
合計ジャッジ時間 1,501 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
18,732 KB
testcase_01 AC 17 ms
18,732 KB
testcase_02 AC 16 ms
18,704 KB
testcase_03 AC 16 ms
18,748 KB
testcase_04 AC 15 ms
18,720 KB
testcase_05 AC 15 ms
18,728 KB
testcase_06 AC 15 ms
18,732 KB
testcase_07 AC 16 ms
18,720 KB
testcase_08 AC 16 ms
18,680 KB
testcase_09 AC 16 ms
18,728 KB
testcase_10 AC 16 ms
18,760 KB
testcase_11 AC 15 ms
18,660 KB
testcase_12 AC 16 ms
18,700 KB
testcase_13 AC 16 ms
18,528 KB
testcase_14 AC 15 ms
18,664 KB
testcase_15 AC 16 ms
18,732 KB
testcase_16 AC 16 ms
18,548 KB
testcase_17 AC 16 ms
18,764 KB
testcase_18 AC 16 ms
18,780 KB
testcase_19 AC 15 ms
18,860 KB
testcase_20 AC 16 ms
18,692 KB
testcase_21 AC 15 ms
18,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
/*ハルカちゃんとユウちゃんはとっても仲良しなので、2人でポッキーゲームをすることにしました。

長さが L(mm) のポッキーを2人はそれぞれ両端から中央に向かって齧っていきます。
2人とも毎回 K(mm) ずつ同じタイミングでポッキーを齧ります。
ユウちゃんは恥ずかしがり屋さんなので、
次のタイミングで2人ともポッキーを齧ろうとしたら唇が触れてしまうと分かった時点で齧り進めるのを止めて、
残りは全部ハルカちゃんが食べてしまいます。

このとき、ユウちゃんが食べるポッキーの長さは何mmか?

入力
L K
入力 L,K はそれぞれ整数値で与えられる。
1≤L≤109 はゲームに用いるポッキーの長さを表す。
1≤K≤50 はお互いが1回に齧るポッキーの長さを表す。
残りのポッキーの長さが0(もしくはそれ以下)で唇が触れるものとする。
*/

$LK =explode(" ",trim(fgets(STDIN)));

if(is_int($LK[0]/($LK[1]*2))){
  echo (floor($LK[0]/($LK[1]*2))-1)*$LK[1];
}else{
  echo floor($LK[0]/($LK[1]*2))*$LK[1];
}
?>
0