Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int quantity = Integer.parseInt(scanner.nextLine());
- int days = Integer.parseInt(scanner.nextLine());
- int ornamentSet = 2;
- int threeSkirt = 5;
- int threeGarlands = 3;
- int threeLights = 15;
- int spirit = 0;
- for (int i = quantity; i <= days; i++) {
- if (i % 2 == 0 ){
- quantity = quantity + ornamentSet;
- spirit = spirit + 5;
- }
- if (i % 3 == 0){
- quantity = quantity + threeSkirt + threeGarlands;
- spirit = spirit + 13;
- }if (i % 5 == 0){
- quantity = quantity + threeLights;
- spirit = spirit + 17;
- if (quantity == days){
- quantity = quantity + threeSkirt + threeGarlands;
- spirit = spirit + 30;
- }
- }if (i % 10 == 0) {
- spirit = spirit - 20;
- quantity = quantity + ornamentSet + threeSkirt + threeGarlands + threeLights;
- }
- if(days == 10){
- spirit = spirit - 30;
- }if (days % 11 == 0){
- quantity = quantity + 2;
- }
- }
- System.out.println(String.format("Total cost: %d", quantity));
- System.out.println(String.format("Total spirit: %d", spirit));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement