forked from Mohammed-Shoaib/Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathE0069.cpp
More file actions
33 lines (29 loc) · 645 Bytes
/
E0069.cpp
File metadata and controls
33 lines (29 loc) · 645 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
// Problem Code: CHEFSTON
#include <iostream>
#include <vector>
#include <limits>
using namespace std;
long long chefAndStones(int K, vector<int> A, vector<int> B) {
long long profit, maxProfit = numeric_limits<long long>::min();
for (int i = 0 ; i < A.size() ; i++) {
profit = (long long) (K / A[i]) * B[i];
if (profit > maxProfit)
maxProfit = profit;
}
return maxProfit;
}
int main() {
int T;
cin >> T;
while (T--) {
int N, K;
cin >> N >> K;
vector<int> A(N), B(N);
for (int i = 0 ; i < N ; i++)
cin >> A[i];
for (int i = 0 ; i < N ; i++)
cin >> B[i];
cout << chefAndStones(K, A, B) << endl;
}
return 0;
}