rudi2004

9. Spice Must Flow

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