Advertisement
Spocoman

10. Poke Mon

Oct 18th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine()),
  7.             m = Integer.parseInt(scanner.nextLine()),
  8.             y = Integer.parseInt(scanner.nextLine()),
  9.             counter = 0;
  10.  
  11.         double x = n / 2;
  12.  
  13.         while (n >= m) {
  14.             n -= m;
  15.             counter++;
  16.             if (n == x && y != 0) {
  17.                 n /= y;
  18.             }
  19.         }
  20.            
  21.         System.out.println(n + "\n" + counter);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement