Advertisement
Guest User

Untitled

a guest
Sep 20th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PokeMon
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int power = int.Parse(Console.ReadLine());
  10.             int distance = int.Parse(Console.ReadLine());
  11.             int exhaustionFactor = int.Parse(Console.ReadLine());
  12.  
  13.             int restPower = power;
  14.             int targetsCount = 0;
  15.  
  16.             while (restPower >= distance)
  17.             {
  18.                 if (restPower == power * 0.5 && exhaustionFactor != 0)
  19.                 {
  20.                     restPower /= exhaustionFactor;
  21.                 }
  22.               if (restPower < distance)
  23.                 {
  24.                     break;
  25.                 }
  26.                 restPower -= distance;
  27.                 targetsCount++;
  28.             }
  29.             Console.WriteLine(restPower);
  30.             Console.WriteLine(targetsCount);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement