Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package com.company;
  2.  
  3. import javax.swing.*;
  4. import java.beans.IntrospectionException;
  5. import java.util.Scanner;
  6.  
  7. public class Main {
  8.  
  9. public static void main(String[] args) {
  10. Scanner scanner = new Scanner(System.in);
  11.  
  12. int n = Integer.parseInt(scanner.nextLine());
  13. int m = Integer.parseInt(scanner.nextLine());
  14. int y = Integer.parseInt(scanner.nextLine());
  15. int count = 0;
  16. double halfOfOriginalValue = n /2.0;
  17. while (n >= m) {
  18. n-=m;
  19. if (n == halfOfOriginalValue && y > 0) {
  20. n /= y;
  21. }
  22. count++;
  23. }
  24. System.out.println(n);
  25. System.out.println(count);
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement