diff options
Diffstat (limited to 'codechef/chefAndHisApps/main.cpp')
| -rw-r--r-- | codechef/chefAndHisApps/main.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/codechef/chefAndHisApps/main.cpp b/codechef/chefAndHisApps/main.cpp new file mode 100644 index 0000000..8d38e22 --- /dev/null +++ b/codechef/chefAndHisApps/main.cpp @@ -0,0 +1,33 @@ +#include <bits/stdc++.h> + +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + int s, x, y, z; + cin >> s >> x >> y >> z; + int xy = x + y; + int free = s - xy; + int count = 0; + int mx = max(x, y); + // 3 <= 7 + if (z <= free) { + cout << 0 << endl; + } else { + while (z > free) { + z -= max(x, y); + if (x > y) { + x = 0; + } else { + y = 0; + } + count++; + } + cout << count << endl; + } + } +} |
