Didart

Poke Mon

Sep 24th, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PokeMon {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int power = Integer.parseInt(scanner.nextLine());
  8.         int distance = Integer.parseInt(scanner.nextLine());
  9.         int exhaustionFactor = Integer.parseInt(scanner.nextLine());
  10.  
  11.         int count = 0;
  12.         int firstTimePower = power;
  13.         while (power >= distance) {
  14.             power -= distance;
  15.             count++;
  16.  
  17.            if (power == firstTimePower * 0.5) {
  18.                if (exhaustionFactor > 0) {
  19.                    power = power / exhaustionFactor;
  20.                }
  21.            }
  22.         }
  23.         System.out.println(power);
  24.         System.out.println(count);
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment