結果

問題 No.63 ポッキーゲーム
ユーザー popopopepepe1popopopepepe1
提出日時 2019-09-29 08:35:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 445 bytes
コンパイル時間 2,475 ms
コンパイル使用メモリ 75,612 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-04-14 07:11:22
合計ジャッジ時間 6,700 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
54,360 KB
testcase_01 AC 140 ms
54,348 KB
testcase_02 AC 136 ms
53,984 KB
testcase_03 AC 141 ms
54,268 KB
testcase_04 AC 142 ms
54,304 KB
testcase_05 AC 143 ms
53,900 KB
testcase_06 AC 141 ms
54,252 KB
testcase_07 AC 140 ms
54,148 KB
testcase_08 AC 140 ms
54,164 KB
testcase_09 AC 140 ms
54,280 KB
testcase_10 AC 141 ms
54,232 KB
testcase_11 AC 141 ms
54,092 KB
testcase_12 AC 141 ms
53,836 KB
testcase_13 AC 145 ms
54,320 KB
testcase_14 AC 144 ms
54,148 KB
testcase_15 AC 142 ms
54,356 KB
testcase_16 AC 142 ms
54,220 KB
testcase_17 AC 144 ms
53,972 KB
testcase_18 AC 139 ms
54,144 KB
testcase_19 AC 143 ms
54,412 KB
testcase_20 AC 158 ms
54,180 KB
testcase_21 AC 140 ms
54,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int x = sc.nextInt();
    
    if(N/x/2==1 && N%(x*2)==0){
        System.out.println(0);
    }else if(N%(x*2)==0){
        int j=N/(x*2);
        int y=(j-1)*x;
        System.out.println(y);
    }else{
        int y=(N/x/2)*x;
        System.out.println(y);
    }

  }
}
0