Created
May 23, 2020 04:38
-
-
Save nabetama/97060a5d068b92499b64aeb315482b1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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