結果

問題 No.1869 Doubling?
ユーザー tentententen
提出日時 2022-03-18 11:52:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,213 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 77,592 KB
実行使用メモリ 50,576 KB
最終ジャッジ日時 2024-04-10 12:47:13
合計ジャッジ時間 5,222 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,916 KB
testcase_01 AC 45 ms
50,264 KB
testcase_02 AC 45 ms
50,276 KB
testcase_03 AC 46 ms
50,516 KB
testcase_04 AC 44 ms
50,340 KB
testcase_05 AC 46 ms
49,896 KB
testcase_06 AC 46 ms
50,420 KB
testcase_07 AC 46 ms
50,404 KB
testcase_08 AC 48 ms
50,008 KB
testcase_09 AC 46 ms
50,428 KB
testcase_10 AC 46 ms
50,288 KB
testcase_11 AC 46 ms
50,292 KB
testcase_12 AC 48 ms
50,408 KB
testcase_13 WA -
testcase_14 AC 45 ms
50,572 KB
testcase_15 AC 44 ms
50,336 KB
testcase_16 AC 45 ms
50,048 KB
testcase_17 AC 43 ms
50,316 KB
testcase_18 AC 44 ms
50,376 KB
testcase_19 AC 45 ms
49,880 KB
testcase_20 AC 45 ms
50,384 KB
testcase_21 AC 44 ms
49,908 KB
testcase_22 AC 45 ms
50,392 KB
testcase_23 AC 44 ms
50,400 KB
testcase_24 AC 44 ms
50,428 KB
testcase_25 AC 44 ms
50,028 KB
testcase_26 AC 45 ms
50,208 KB
testcase_27 AC 47 ms
50,408 KB
testcase_28 AC 46 ms
50,292 KB
testcase_29 AC 47 ms
50,440 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 45 ms
50,300 KB
testcase_34 AC 49 ms
50,460 KB
testcase_35 AC 47 ms
50,404 KB
testcase_36 AC 46 ms
50,124 KB
testcase_37 AC 46 ms
49,900 KB
testcase_38 AC 44 ms
50,268 KB
testcase_39 AC 44 ms
50,032 KB
testcase_40 AC 44 ms
50,048 KB
testcase_41 AC 45 ms
50,232 KB
testcase_42 WA -
testcase_43 AC 45 ms
50,248 KB
testcase_44 AC 45 ms
50,240 KB
testcase_45 AC 46 ms
50,064 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();
        if (n < 30 && (1 << (n - 1)) <= m) {
            System.out.println((1 << n) - 1);
            return;
        }
        int total = 0;
        while (m > 1) {
            total += m;
            m = (m + 1) / 2;
            n--;
        }
        total += n;
        System.out.println(total);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    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 {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0