Advertisement
vkarakolev

Untitled

Oct 16th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E10_PokeMon {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         short m = scanner.nextShort();
  8.         byte y = scanner.nextByte();
  9.         short targetCount = 0;
  10.         int halfN = n / 2;
  11.  
  12.         while (n > m) {
  13.             n -= m;
  14.             targetCount++;
  15.  
  16.             if (n == halfN) {
  17.                 if (n / y > 0) {
  18.                     n /= y;
  19.                 }
  20.             }
  21.         }
  22.         System.out.println(n);
  23.         System.out.print(targetCount);
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement