Advertisement
yocalee

Poke Mon

Jan 28th, 2020
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4.         import java.util.Scanner;
  5.  
  6. public class Jedi {
  7.     public static void main(String[] args) {
  8.         Scanner scanner=new Scanner(System.in);
  9.  
  10.  
  11.         int n= Integer.parseInt(scanner.nextLine());
  12.         int m= Integer.parseInt(scanner.nextLine());
  13.         byte y= Byte.parseByte(scanner.nextLine());
  14.  
  15.         int z=n;
  16.         int countPoked=0;
  17.         boolean flag=false;
  18.         while(m<z){
  19.             z=z-m;
  20.             countPoked++;
  21.             if (z==m && n%2==0){
  22.                 n=z/y;
  23.                 flag=true;
  24.                 System.out.println(n);
  25.                 System.out.println(countPoked);
  26.                 break;
  27.             }else if (z==m && n%2!=0){
  28.                 flag=false;
  29.                 continue;
  30.             }
  31.         }
  32.         if(flag==false){
  33.             System.out.println(z);
  34.             System.out.println(countPoked);}
  35.  
  36.  
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement