結果

問題 No.598 オーバーフローファンタジー
ユーザー mtsd
提出日時 2017-11-24 22:27:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 71,740 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 01:35:17
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007

int main(){
	ll n,x,a,b;
	cin >> n >> x >> a >> b;
	ll p,q;
	ll ov=1;
	for(int i=1;i<n;i++){
		ov*=2;
	}
	p = x/a;
	if(x%a!=0){
		p++;
	}
	q = (ov-x)/b;
	if((ov-x)%b!=0){
		q++;
	} 
	cout << min(p,q) << endl;
	return 0;
}
0