Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scalefocus;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int startingYield = Integer.parseInt(sc.nextLine());
- int remainingYield = startingYield;
- int day = 0;
- int totalMined = 0;
- int finalTotalMined = 0;
- while (remainingYield >= 100) {
- int spiceMined = remainingYield;
- int dailyMined = spiceMined - 26;
- totalMined += dailyMined;
- remainingYield -= 10;
- day += 1;
- }
- if (day == 0) {
- finalTotalMined = totalMined;
- } else {
- finalTotalMined = totalMined - 26;
- }
- System.out.println(day);
- System.out.println(finalTotalMined);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement