結果

問題 No.1869 Doubling?
ユーザー ytqm3
提出日時 2022-02-05 14:39:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 221 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 66,624 KB
最終ジャッジ日時 2025-01-27 20:27:52
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
  long N,X,ans=0;
  cin>>N>>X;
  if(0<(X>>N-1)){
    cout<<(1L<<N)-1<<endl;
    return 0;
  }
  while(1<X){
    ans+=X,X=(X+1)/2,N--;
  }
  ans+=N;
  cout<<ans<<endl;
}
0