結果

問題 No.63 ポッキーゲーム
ユーザー TakaTaka
提出日時 2016-04-09 16:38:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 387 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 71,108 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-08-25 19:08:35
合計ジャッジ時間 6,390 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,884 KB
testcase_01 AC 115 ms
56,184 KB
testcase_02 AC 115 ms
55,996 KB
testcase_03 AC 113 ms
56,292 KB
testcase_04 AC 118 ms
55,584 KB
testcase_05 AC 117 ms
56,016 KB
testcase_06 AC 117 ms
55,884 KB
testcase_07 AC 117 ms
55,540 KB
testcase_08 AC 113 ms
56,120 KB
testcase_09 AC 116 ms
55,928 KB
testcase_10 AC 122 ms
55,628 KB
testcase_11 AC 377 ms
55,696 KB
testcase_12 AC 124 ms
55,952 KB
testcase_13 AC 387 ms
56,036 KB
testcase_14 AC 137 ms
55,704 KB
testcase_15 AC 131 ms
55,916 KB
testcase_16 AC 116 ms
56,096 KB
testcase_17 AC 361 ms
55,940 KB
testcase_18 AC 125 ms
56,152 KB
testcase_19 AC 161 ms
56,132 KB
testcase_20 AC 126 ms
55,780 KB
testcase_21 AC 134 ms
55,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
		
        Scanner sc = new Scanner(System.in);
		
       	int L = sc.nextInt();
        int K = sc.nextInt();
		
		int nokori=L-K*2;
		int yuu=0;
		
		if(L<=K || L==K*2)	yuu=0;
		else if(nokori<=K*2){
			yuu=K;
		}else{
			while(nokori>K*2){
				nokori = L-K*2;
				yuu += K;
				L=nokori;
			}
		}
		
        System.out.println(yuu);
    }
}
0