結果
問題 | No.598 オーバーフローファンタジー |
ユーザー |
|
提出日時 | 2017-11-24 22:45:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 1,464 ms |
コンパイル使用メモリ | 167,556 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-22 23:41:29 |
合計ジャッジ時間 | 3,704 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
#include <bits/stdc++.h> #define REP(i,a,b) for(int i=(a);i<(b);i++) #define RREP(i,a,b) for(int i=(a);i>=(b);i--) #define pq priotity_queue #define P pair<int,int> #define P2 pair<int,P> #define P3 pair<int,P2> typedef long long ll; typedef long double ld; using namespace std; const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0}; const ll LINF=1e18; const ld PI=abs(acos(-1)); int n,h,a,b; int main(){ cin >> n >> h >> a >> b; a=~a+1; int mi=0,c=0,pos=h; while(!(pos&(1<<(n-1)))) pos+=a,mi++; while(!(h&(1<<(n-1)))) h+=b,c++; cout << min(mi,c) << endl; return 0; }