Advertisement
damesova

Christmas Spirit [Mimi]

Mar 7th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. package OLD_MID_EXAMs_18_12_18;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class _01_ChristmasSpirit {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int quantity = Integer.parseInt(scanner.nextLine());
  10.         int days = Integer.parseInt(scanner.nextLine());
  11.  
  12.         int ornamentSet = 2;
  13.         int treeSkirt = 5;
  14.         int treeGarlands = 3;
  15.         int treeLights = 15;
  16.  
  17.         int costs = 0;
  18.         int spirit = 0;
  19.  
  20.         for (int i = 1; i <= days; i++) {
  21.             if (i % 11 == 0){
  22.                 quantity += 2;
  23.             }
  24.  
  25.             if (i % 10 == 0){
  26.                 spirit -= 20;
  27.                 costs += (treeSkirt + treeGarlands + treeLights);
  28.                 if (i == days){
  29.                     spirit -= 30;
  30.                 }
  31.             }
  32.  
  33.             if (i % 5 == 0){
  34.                 costs += (treeLights * quantity);
  35.                 spirit += 17;
  36.                 if (i % 3 == 0){ //допускам, че и 10-я ден влиза в това условие, но не съм сигурна
  37.                     spirit += 30;
  38.                 }
  39.  
  40.             }
  41.  
  42.             if (i % 3 == 0){
  43.                 costs += ((treeSkirt + treeGarlands) * quantity);
  44.                 spirit += 13;
  45.             }
  46.  
  47.             if (i % 2 == 0){
  48.                 costs += (ornamentSet * quantity);
  49.                 spirit += 5;
  50.             }
  51.         }
  52.  
  53.         System.out.println("Total cost: " + costs);
  54.         System.out.println("Total spirit: " + spirit);
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement