結果
| 問題 |
No.1869 Doubling?
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2022-03-11 21:24:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 510 bytes |
| コンパイル時間 | 2,321 ms |
| コンパイル使用メモリ | 191,812 KB |
| 最終ジャッジ日時 | 2025-01-28 08:07:53 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
bool ok = false;
if (N <= 30){
if (M > (1 << N)){
ok = true;
}
}
if (ok){
long long ans = 1;
for (int i = 0; i < N; i++){
ans += 1 << i;
}
cout << ans << endl;
} else {
long long ans = 0;
while (true){
if (M == 1){
ans += N;
break;
} else {
ans += M;
M = (M + 1) / 2;
N--;
}
}
cout << ans << endl;
}
}
SSRS