SHARE
TWEET

Untitled

a guest Jan 24th, 2020 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top