結果
問題 | No.598 オーバーフローファンタジー |
ユーザー |
|
提出日時 | 2017-11-24 23:40:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 403 bytes |
コンパイル時間 | 1,813 ms |
コンパイル使用メモリ | 156,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 01:56:13 |
合計ジャッジ時間 | 2,270 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%lld",&n); | ~~~~~^~~~~~~~~~~ main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%lld",&x); | ~~~~~^~~~~~~~~~~ main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld",&a); | ~~~~~^~~~~~~~~~~ main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%lld",&b); | ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define MOD 1000000007LLusing namespace std;typedef long long ll;typedef pair<int,int> P;ll n,x,a,b;int main(void){scanf("%lld",&n);scanf("%lld",&x);scanf("%lld",&a);scanf("%lld",&b);ll maxi=1LL<<(n-1);ll ans=(x+a-1LL)/a;ll ans2=(maxi-x+b-1LL)/b;ll v=min(ans,ans2);if(!(v*a>=x) && !(b*v>=(maxi-x)))while(1);printf("%lld\n",min(ans,ans2));return 0;}