Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int reachedHeight = 5364, days = 1, daylyHeight;
- String sleep;
- while (reachedHeight < 8848 && !(sleep = scanner.nextLine()).equals("END")) {
- if (sleep.equals("Yes")) {
- if (++days == 6) {
- break;
- }
- }
- daylyHeight = Integer.parseInt(scanner.nextLine());
- reachedHeight += daylyHeight;
- }
- if (reachedHeight >= 8848) {
- System.out.println("Goal reached for " + days + " days!");
- } else {
- System.out.println("Failed!\n" + reachedHeight);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement