結果

問題 No.63 ポッキーゲーム
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-16 01:04:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 1,046 bytes
コンパイル時間 2,830 ms
コンパイル使用メモリ 72,160 KB
実行使用メモリ 49,984 KB
最終ジャッジ日時 2023-08-25 19:39:20
合計ジャッジ時間 3,718 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,540 KB
testcase_01 AC 40 ms
49,392 KB
testcase_02 AC 40 ms
49,336 KB
testcase_03 AC 40 ms
49,312 KB
testcase_04 AC 41 ms
49,452 KB
testcase_05 AC 41 ms
49,192 KB
testcase_06 AC 40 ms
49,192 KB
testcase_07 AC 41 ms
49,172 KB
testcase_08 AC 41 ms
49,248 KB
testcase_09 AC 41 ms
49,984 KB
testcase_10 AC 40 ms
49,396 KB
testcase_11 AC 41 ms
49,660 KB
testcase_12 AC 41 ms
49,296 KB
testcase_13 AC 41 ms
49,488 KB
testcase_14 AC 41 ms
49,388 KB
testcase_15 AC 41 ms
49,264 KB
testcase_16 AC 41 ms
49,316 KB
testcase_17 AC 41 ms
47,768 KB
testcase_18 AC 41 ms
49,332 KB
testcase_19 AC 41 ms
49,528 KB
testcase_20 AC 41 ms
49,336 KB
testcase_21 AC 40 ms
49,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class No63 {

	public static void main(String[] args) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader ( new InputStreamReader(System.in) );
		String [] str = br.readLine().split(" ");
		
		long L = Long.parseLong(str[0]);  //読み込んだ1つ目の数字(文字列)を変数Lに入れる
		long K = Long.parseLong(str[1]);  //同様に2つ目を変数Kに入れる
		long M = 2*K;  //二人が一度に食べる長さ
		
		if( 1 <= L/M && L%M != 0){  //一度以上二人で食べて、あまりがある時
			System.out.println( (L/M) * K );  //二人で食べた回数*ユウちゃんが食べる長さ
		}
		if( 1 <= L/M && L%M == 0 ){  //二人でちょうど食べきる時
		    System.out.println( ((L/M)-1) * K );  //(二人で食べた回数-1)*ユウちゃんが食べる長さ
	    } 
	    if( L/M == 0 ){  //一度も二人同時に食べられない時
	    	System.out.println(0);
	    }
    }
}
0