結果
問題 | No.804 野菜が苦手 |
ユーザー |
![]() |
提出日時 | 2019-03-22 21:46:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 64,284 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 04:03:56 |
合計ジャッジ時間 | 1,130 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<cstdio> using namespace std; int main(){ int a, b, c, d; cin >> a >> b >> c >> d; if (a*c <= b) { if (a*c + a <= d) { cout << a << endl; } else { d = d - d % (c + 1); cout << d / (c + 1)<<endl; } } else { int f = (b - b % c) / c + b - b % c; if (f<=d){ b = b - b % c; cout << b/c << endl; } else { d = d - d % (c + 1); cout << d / (c + 1) << endl; } } return 0; }