結果

問題 No.1869 Doubling?
ユーザー cologne
提出日時 2022-03-11 22:01:37
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 359 bytes
コンパイル時間 4,010 ms
コンパイル使用メモリ 162,864 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 02:17:58
合計ジャッジ時間 3,430 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    long long ans = 0;
    int i = 0;
    for (i = 0; i < N && M != 1; ++i)
    {
        ans += M;
        M = (M + 1) / 2;
    }
    if(i == N && M != 1)
    {
        cout << ((1<<N)-1) << endl;
        return 0;
    }
    ans += N - i;
    cout << ans << endl;
}
0