結果
問題 | No.804 野菜が苦手 |
ユーザー |
![]() |
提出日時 | 2020-06-07 23:36:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 1,116 ms |
コンパイル使用メモリ | 90,368 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 22:40:24 |
合計ジャッジ時間 | 2,010 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include<iostream> #include<math.h> #include<string.h> #include<vector> #include<algorithm> #include<iomanip> #include<deque> #include<map> #include<stdio.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int a,b,c,d; cin >> a >> b >> c >> d; int yasai=0; int eat=0; while(1){ a--; b-=c; if(yasai==0 && b<0){ cout << yasai << endl; return 0; } yasai++; eat+=(1+c); if(eat>d||b<0){ yasai--; cout << yasai << endl; break; } if(eat==d||a==0||b==0){ cout << yasai << endl; break; } } return 0; }