結果

問題 No.598 オーバーフローファンタジー
ユーザー koyumeishi
提出日時 2017-08-28 02:14:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,600 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 63,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 01:26:52
合計ジャッジ時間 3,964 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
  long long n,x,a,b;
  cin >> n >> x >> a >> b;

  long long ans = 1ll<<60;
  long long t = 0;
  for(long long xx = x; xx>0; t++){
    xx -= a;
  }
  ans = t;

  cerr << t << endl;

  t = 0;
  for(long long xx = x; xx>0 && ((~xx>>(n-1))&1); t++){
    xx += b;
  }
  ans = ans > t ? t : ans;

  cerr << t << endl;

  cout << ans << endl;
}
0