結果

問題 No.63 ポッキーゲーム
ユーザー takutakutakutaku
提出日時 2020-09-17 10:35:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 71,468 KB
実行使用メモリ 56,356 KB
最終ジャッジ日時 2023-09-04 07:07:53
合計ジャッジ時間 5,707 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,936 KB
testcase_01 AC 122 ms
55,740 KB
testcase_02 AC 122 ms
56,356 KB
testcase_03 AC 123 ms
56,016 KB
testcase_04 AC 122 ms
56,024 KB
testcase_05 AC 124 ms
55,784 KB
testcase_06 AC 122 ms
55,396 KB
testcase_07 AC 123 ms
55,680 KB
testcase_08 AC 123 ms
53,948 KB
testcase_09 AC 124 ms
55,748 KB
testcase_10 AC 126 ms
55,640 KB
testcase_11 AC 125 ms
55,652 KB
testcase_12 AC 124 ms
56,028 KB
testcase_13 AC 125 ms
55,788 KB
testcase_14 AC 125 ms
55,980 KB
testcase_15 AC 125 ms
55,620 KB
testcase_16 AC 124 ms
53,744 KB
testcase_17 AC 126 ms
55,736 KB
testcase_18 AC 126 ms
56,056 KB
testcase_19 AC 125 ms
55,720 KB
testcase_20 AC 128 ms
55,832 KB
testcase_21 AC 123 ms
56,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
	    
	    // 標準入力を受け取る
	    Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int k = sc.nextInt();
        
        // 一度に齧る二人分のポッキーの距離
        int b = k * 2;
        
        // 齧る回数と残る距離
        int n = l / b;
        int m = l % b;
        
        // 辻褄合わせ
        if(m == 0) {
            n--;
        }
        
        System.out.println(n * k);
        
	}
}

0