結果

問題 No.1869 Doubling?
ユーザー tentententen
提出日時 2022-09-28 09:16:25
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,383 bytes
コンパイル時間 3,323 ms
コンパイル使用メモリ 73,676 KB
実行使用メモリ 52,228 KB
最終ジャッジ日時 2023-08-24 04:16:37
合計ジャッジ時間 11,474 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,272 KB
testcase_01 AC 46 ms
48,996 KB
testcase_02 AC 46 ms
49,420 KB
testcase_03 AC 795 ms
50,164 KB
testcase_04 AC 1,971 ms
52,228 KB
testcase_05 TLE -
testcase_06 AC 47 ms
49,412 KB
testcase_07 AC 47 ms
49,304 KB
testcase_08 AC 48 ms
51,144 KB
testcase_09 AC 45 ms
49,108 KB
testcase_10 AC 47 ms
49,132 KB
testcase_11 AC 46 ms
49,096 KB
testcase_12 AC 48 ms
49,312 KB
testcase_13 AC 53 ms
49,532 KB
testcase_14 AC 56 ms
49,120 KB
testcase_15 AC 54 ms
49,132 KB
testcase_16 AC 56 ms
49,408 KB
testcase_17 AC 54 ms
49,408 KB
testcase_18 AC 51 ms
49,044 KB
testcase_19 AC 59 ms
49,048 KB
testcase_20 AC 56 ms
51,400 KB
testcase_21 AC 61 ms
49,128 KB
testcase_22 AC 55 ms
49,144 KB
testcase_23 AC 59 ms
49,048 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 49 ms
51,136 KB
testcase_34 AC 47 ms
49,276 KB
testcase_35 AC 47 ms
49,320 KB
testcase_36 AC 47 ms
51,396 KB
testcase_37 AC 45 ms
49,296 KB
testcase_38 AC 47 ms
49,536 KB
testcase_39 AC 47 ms
49,240 KB
testcase_40 AC 48 ms
49,144 KB
testcase_41 AC 49 ms
49,444 KB
testcase_42 TLE -
testcase_43 TLE -
testcase_44 AC 45 ms
49,408 KB
testcase_45 AC 44 ms
49,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        int start;
        if (n < 31 && m > (1 << (n - 1))) {
            start = (1 << (n - 1));
        } else {
            start = m;
        }
        long ans = 0;
        for (int i = 0; i < n; i++) {
            ans += start;
            if (start % 2 == 0) {
                start /= 2;
            } else {
                start = (start + 1) / 2;
            }
        }
        System.out.println(ans);
    }
}
    
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0