desislava_topuzakova

09. Spice Must Flow

Jan 23rd, 2021
953
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SpiceMustFlow_09 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int startingYield = Integer.parseInt(scanner.nextLine());
  9.         int crewConsumption = 26;
  10.         int days = 0;
  11.         int totalSpices = 0;
  12.  
  13.         if (startingYield >= 100) {
  14.             while (startingYield >= 100) {
  15.                 totalSpices += startingYield - crewConsumption;
  16.                 startingYield -= 10;
  17.                 days++;
  18.             }
  19.             totalSpices -= 26;
  20.         }
  21.         System.out.println(days);
  22.         System.out.println(totalSpices);
  23.     }
  24. }
  25.  
RAW Paste Data