desislava_topuzakova

10. Poke Mon

Jan 23rd, 2021
657
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Pokemon_10 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int power = Integer.parseInt(scanner.nextLine());
  9.         int distance = Integer.parseInt(scanner.nextLine());
  10.         int exhaustionFactor = Integer.parseInt(scanner.nextLine());
  11.  
  12.  
  13.         int pokedTarget = 0;
  14.         double half = power / 2.0;
  15.  
  16.         while (power >= distance) {
  17.             pokedTarget++;
  18.             power -= distance;
  19.  
  20.             if (half == power) {
  21.                 if (exhaustionFactor > 0) {
  22.                     power /= exhaustionFactor;
  23.                 }
  24.             }
  25.         }
  26.         System.out.println(power);
  27.         System.out.println(pokedTarget);
  28.     }
  29. }
RAW Paste Data