Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Profit {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int oneBGNCoinCount = Integer.parseInt(scanner.nextLine()),
- twoBGNCoinCount = Integer.parseInt(scanner.nextLine()),
- fiveBGNCoinCount = Integer.parseInt(scanner.nextLine()),
- sum = Integer.parseInt(scanner.nextLine());
- for (int i = 0; i <= oneBGNCoinCount; i++) {
- for (int j = 0; j <= twoBGNCoinCount; j++) {
- for (int k = 0; k <= fiveBGNCoinCount; k++) {
- if (i + j * 2 + k * 5 == sum) {
- System.out.printf("%d * 1 lv. + %d * 2 lv. + %d * 5 lv. = %d lv.\n", i, j, k, sum);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement