結果
問題 | No.1869 Doubling? |
ユーザー |
![]() |
提出日時 | 2022-03-11 21:58:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 3,547 ms |
コンパイル使用メモリ | 228,056 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 02:13:28 |
合計ジャッジ時間 | 4,837 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll=long long; using Graph=vector<vector<pair<int,ll>>>; #define INF 1000000000000000000 #define MOD 998244353 #define MAX 1000000 int main(){ ll N,M; cin>>N>>M; ll ans=0; if(N<=30&&(1<<(N-1))<=M){ ans=(1LL<<N)-1; }else{ while(N>0){ if(M==1){ ans+=N; break; } ans+=M; M=(M+1)/2; N--; } } cout<<ans<<'\n'; }