-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Shashliks.cpp
More file actions
47 lines (39 loc) · 754 Bytes
/
A_Shashliks.cpp
File metadata and controls
47 lines (39 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <bits/stdc++.h>
using namespace std;
inline void n_lamba_29() {
int k, a, b, x, y;
cin >> k >> a >> b >> x >> y;
int K = k;
int ans = 0;
if(k >= a) {
int temp = (k - a) / x + 1;
ans += temp;
k -= x * temp;
}
if(k >= b) {
int temp = (k - b) / y + 1;
ans += temp;
}
int ans2 = 0;
k = K;
if(k >= b) {
int t = (k - b) / y + 1;
ans2 += t;
k -= y * t;
}
if(k >= a) {
int t = (k - a) / x + 1;
ans2 += t;
}
cout << max(ans, ans2) << "\n";
}
int32_t main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int _;
cin >> _;
while (_-->0) {
n_lamba_29();
}
return 0;
}