Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package OLD_MID_EXAMs_18_12_18;
- import java.util.Scanner;
- public class _01_ChristmasSpirit {
- 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 treeSkirt = 5;
- int treeGarlands = 3;
- int treeLights = 15;
- int costs = 0;
- int spirit = 0;
- for (int i = 1; i <= days; i++) {
- if (i % 11 == 0){
- quantity += 2;
- }
- if (i % 10 == 0){
- spirit -= 20;
- costs += (treeSkirt + treeGarlands + treeLights);
- if (i == days){
- spirit -= 30;
- }
- }
- if (i % 5 == 0){
- costs += (treeLights * quantity);
- spirit += 17;
- if (i % 3 == 0){ //допускам, че и 10-я ден влиза в това условие, но не съм сигурна
- spirit += 30;
- }
- }
- if (i % 3 == 0){
- costs += ((treeSkirt + treeGarlands) * quantity);
- spirit += 13;
- }
- if (i % 2 == 0){
- costs += (ornamentSet * quantity);
- spirit += 5;
- }
- }
- System.out.println("Total cost: " + costs);
- System.out.println("Total spirit: " + spirit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement