Guest User

Untitled

a guest
Feb 3rd, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.41 KB | None | 0 0
  1. /*A Poke Mon is a special type of pokemon which likes to
  2.  Poke others. But at the end of the day, the Poke Mon wants
  3.  to keeps statistics, about how many pokes it has managed to
  4.  make.
  5.  
  6. █▀█ ▀ █─▄▀ ▄▀▄ ▄▀ █     █  █
  7. █▄█ █ █▀▄─ █▀█ █─ █▀▄ █─█
  8. █     ▀ ▀─ ▀▀ ▀─▀ ─▀ ▀ ─▀   ▀
  9.  
  10. _¶___________¶¶¶
  11. _¶¶__________¶__¶
  12. ¶__¶_________¶___¶
  13. ¶___¶________¶___¶
  14. ¶____¶_______¶____¶¶¶¶¶¶
  15. ¶_____¶______¶__________¶¶
  16. ¶______¶¶¶__¶_¶¶_________¶¶¶¶¶¶¶¶¶¶¶¶¶
  17. ¶_____¶___¶¶_¶¶¶¶________________¶¶¶¶
  18. _¶___¶___¶¶___¶¶_______¶¶__¶¶¶¶¶¶
  19. __¶__¶__¶___¶_____¶___¶¶¶¶_¶
  20. ___¶_¶_¶_______________¶¶__¶
  21. ¶¶¶__¶¶_________¶¶¶¶______¶
  22. ¶___¶__¶_________¶¶____¶__¶
  23. _¶___¶_¶_________________¶
  24. __¶__¶_¶________________¶¶
  25. ___¶_¶¶___________________¶¶
  26. ____¶¶_________________¶¶___¶
  27. ____¶_________________¶__¶___¶
  28. ___¶_________________¶____¶¶¶¶
  29. __¶___________________¶
  30. __¶____________________¶
  31. __¶_____¶¶¶¶¶¶¶¶_______¶
  32. ___¶__¶¶________¶¶____¶
  33. ___¶__¶___________¶____¶¶
  34. __¶¶¶¶_____________¶¶¶¶¶¶¶¶
  35.  
  36. The Poke Mon pokes his target, and then proceeds to poke
  37. another target. The distance between his targets reduces his
  38. poke power.
  39. You will be given the poke power the Poke Mon has, N – an
  40. integer.
  41. Then you will be given the distance between the poke targets,
  42. M – an integer.
  43. Then you will be given the exhaustionFactor Y – an integer.
  44. Your task is to start subtracting M from N until N becomes less
  45. than M, i.e. the Poke Mon does not have enough power to reach
  46. the next target.
  47. Every time you subtract M from N that means you’ve reached a
  48. target and poked it successfully. COUNT how many targets
  49. you’ve poked – you’ll need that count.
  50. The Poke Mon becomes gradually more exhausted. IF N becomes
  51. equal to EXACTLY 50 % of its original value, you must divide
  52. N by Y, if it is POSSIBLE. This DIVISION is between integers.
  53. If a division is not possible, you should NOT do it. Instead,
  54. you should continue subtracting.
  55. After dividing, you should continue subtracting from N, until
  56. it becomes less than M.
  57. When N becomes less than M, you must take what has remained
  58. of N and the count of targets you’ve poked, and print them
  59. as output.
  60.  
  61. NOTE: When you are calculating percentages, you should be
  62. PRECISE at maximum.
  63. Example: 505 is NOT EXACTLY 50 % from 1000, its 50.5 %.
  64.  
  65. Input
  66.     • The input consists of 3 lines.
  67.     • On the first line you will receive N – an integer.
  68.     • On the second line you will receive M – an integer.
  69.     • On the third line you will receive Y – an integer.
  70. Output
  71.     • The output consists of 2 lines.
  72.     • On the first line print what has remained of N, after subtracting from it.
  73.     • On the second line print the count of targets, you’ve managed to poke.
  74. Constrains
  75.     • The integer N will be in the range [1, 2.000.000.000].
  76.     • The integer M will be in the range [1, 1.000.000].
  77.     • The integer Y will be in the range [0, 9].
  78.     • Allowed time / memory: 16 MB / 100ms.
  79. _________________________________________________
  80. INPUT                                  OUTPUT
  81. 5                                        1
  82. 2                                        2
  83. 3
  84. _________________________________________________
  85. 10                                       2
  86. 5                                        1
  87. 2
  88. _________________________________________________
  89. */
  90. using System;
  91.  
  92. namespace _10Pokemon
  93. {
  94.     class Program
  95.     {
  96.         static void Main(string[] args)
  97.         {
  98.             int pokePower = int.Parse(Console.ReadLine());
  99.             int distance = int.Parse(Console.ReadLine());
  100.             int exhaustionFactor = int.Parse(Console.ReadLine());
  101.  
  102.             int count = 0;
  103.             double halfPower = pokePower / 2.0;
  104.  
  105.             while (pokePower >= distance)
  106.             {
  107.                 count++;
  108.                 pokePower -= distance;
  109.  
  110.                 if (halfPower == pokePower)
  111.                 {
  112.                     if (exhaustionFactor > 0)
  113.                     {
  114.                         pokePower /= exhaustionFactor;
  115.                     }
  116.                 }
  117.             }
  118.             Console.WriteLine(pokePower);
  119.             Console.WriteLine(count);
  120.         }
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment