結果
問題 |
No.1869 Doubling?
|
ユーザー |
|
提出日時 | 2022-03-12 17:40:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 504 bytes |
コンパイル時間 | 1,916 ms |
コンパイル使用メモリ | 193,440 KB |
最終ジャッジ日時 | 2025-01-28 09:16:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; const ll mod = 998244353; int main() { int N, M; cin >> N >> M; ll ans = M; int cnt = 1; while (M > 1) { if (M % 2 == 0) { M /= 2; ans += M; } else { M = M / 2 + 1; ans += M; } cnt++; } while (cnt < N) { cnt++; ans++; } cout << ans << endl; }