Advertisement
jkonova

Untitled

Sep 20th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 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.             double 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.                 restPower -= distance;
  23.                 targetsCount++;
  24.             }
  25.             Console.WriteLine(restPower);
  26.             Console.WriteLine(targetsCount);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement