Advertisement
skipter

PF Exam 09July2017 - 1. Poke Mon

Sep 24th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. namespace RevisonSomething
  2. {
  3.     using System;
  4.     public class Program
  5.     {
  6.         static void Main()
  7.         {
  8.             int n = int.Parse(Console.ReadLine());
  9.             int m = int.Parse(Console.ReadLine());
  10.             int y = int.Parse(Console.ReadLine());
  11.  
  12.             double nDevidedByTwo = n / 2.0;
  13.             int pokeCounter = 0;
  14.  
  15.             while (n >= m)
  16.             {
  17.                 if (n == nDevidedByTwo)
  18.                 {
  19.                     if (y != 0)
  20.                     {
  21.                         n = n / y;
  22.                     }
  23.                     if (n >= m)
  24.                     {
  25.                         n -= m;
  26.                         pokeCounter++;
  27.                     }
  28.                 }
  29.                 else
  30.                 {
  31.                     n -= m;
  32.                     pokeCounter++;
  33.                 }
  34.             }
  35.             Console.WriteLine(n);
  36.             Console.WriteLine(pokeCounter);
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement