結果

問題 No.1869 Doubling?
ユーザー elpheelphe
提出日時 2024-11-13 17:22:50
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 357 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 69,356 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-13 17:22:53
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	uint32_t N, M;
	cin >> N >> M;

	uint64_t ans = 0;
	if (N <= 30 && M >= (1u << N)) cout << (1u << (N + 1)) << '\n';
	else
	{
		for (; N != 0 && M != 1; --N, M = (M + 1) >> 1)
			ans += M;

		cout << ans + N << '\n';
	}
	return 0;
}
0