Skip to content

Instantly share code, notes, and snippets.

@nabetama
Created May 23, 2020 04:38
Show Gist options
  • Save nabetama/97060a5d068b92499b64aeb315482b1d to your computer and use it in GitHub Desktop.
Save nabetama/97060a5d068b92499b64aeb315482b1d to your computer and use it in GitHub Desktop.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int companyNum = scanner.nextInt();
List<Integer> incomes = new ArrayList<>();
List<Integer> taxPer = new ArrayList<>();
for (int i = 0; i < companyNum; i++) {
incomes.add(scanner.nextInt());
}
for (int i = 0; i < companyNum; i++) {
taxPer.add(scanner.nextInt());
}
int mostPayedCompanyIndex = 0;
int maxPayedTax = 0;
for (int i = 0; i < incomes.size(); i++) {
int tax = getPayedTax(incomes.get(i), taxPer.get(i));
if (maxPayedTax < tax) {
mostPayedCompanyIndex = i;
maxPayedTax = tax;
}
}
System.out.println(mostPayedCompanyIndex + 1);
}
private static int getPayedTax(int income, int taxPer) {
return income * taxPer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment