Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine()),
- m = Integer.parseInt(scanner.nextLine()),
- y = Integer.parseInt(scanner.nextLine()),
- counter = 0;
- double x = n / 2;
- while (n >= m) {
- n -= m;
- counter++;
- if (n == x && y != 0) {
- n /= y;
- }
- }
- System.out.println(n + "\n" + counter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement