Advertisement
silvana1303

poke mon

May 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. namespace exampreparation
  7. {
  8.     class exam
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             // distance between targets reduces poke power
  13.             // N - poke power
  14.             // M - distance between targets
  15.             // Y - exhaustion
  16.             // M - N (succesful targeting - count it) until N < M
  17.             // if N becomes 0.5 of itself -> divide N/Y (if possible / int division)
  18.             //if not possible -> continue
  19.             // when N < M -> print remains of N and count of targets
  20.             // percentage calculating precise at maximum
  21.  
  22.             int n = int.Parse(Console.ReadLine());
  23.             int m = int.Parse(Console.ReadLine());
  24.             int y = int.Parse(Console.ReadLine());
  25.  
  26.             int count = 0;
  27.             decimal isN = (decimal)n * (50.0m / 100.0m);
  28.  
  29.             while (n >= m)
  30.             {
  31.                 n -= m;
  32.  
  33.                 if (n == isN)
  34.                 {
  35.                     n /= y;
  36.                 }
  37.                 else
  38.                 {
  39.                     continue;
  40.                 }
  41.                
  42.                 count++;
  43.             }
  44.  
  45.             Console.WriteLine(n);
  46.             Console.WriteLine(count);
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement