Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int m = int.Parse(Console.ReadLine());
  15.             int y = int.Parse(Console.ReadLine());
  16.             int counter = 0;
  17.             int originalN = n;
  18.             while (n >= m)
  19.             {
  20.                 n -= m;
  21.                 if (originalN / 2 == n)
  22.                 {
  23.                     n = n / y;
  24.                 }
  25.                 counter++;
  26.             }
  27.             Console.WriteLine(n);
  28.             Console.WriteLine(counter);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement