Advertisement
mark79

Java Fundamentals - Spice Must Flow

May 24th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpiceMustFlow {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int yield = Integer.parseInt(scanner.nextLine());
  8.         int totalSpice = 0;
  9.         int days = 0;
  10.  
  11.         while (yield >= 100) {
  12.             days++;
  13.             totalSpice += yield - 26;
  14.             yield -= 10;
  15.         }
  16.  
  17.         if (days > 0) {
  18.             totalSpice -= 26;
  19.         }
  20.  
  21.         System.out.println(days);
  22.         System.out.println(totalSpice);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement