-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchefston.java
More file actions
executable file
·45 lines (42 loc) · 1.32 KB
/
chefston.java
File metadata and controls
executable file
·45 lines (42 loc) · 1.32 KB
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Neel_Kapadia
*/
import java.io.*;
public class chefston {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int T,N,K,i,profit=0,p,j;
int [] Ai,Bi;
String str[];
T = Integer.parseInt(br.readLine());
while (T-- > 0){
str = br.readLine().split("\\s+");
N = Integer.parseInt(str[0]);
K = Integer.parseInt(str[1]);
Ai = new int[N];
Bi = new int[N];
str = br.readLine().split("\\s+");
for(i=0;i<N;i++)
Ai[i]=Integer.parseInt(str[i]);
str = br.readLine().split("\\s+");
for(i=0;i<N;i++)
Bi[i]=Integer.parseInt(str[i]);
for(i=0;i<N;i++)
{
j=K/Ai[i];
p = j*Bi[i];
if(p >= profit)
profit=p;
}
pw.println(profit);
}
pw.flush();
}
}