Advertisement
alexbancheva

Volleyball

Nov 10th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Volleyball
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string year = Console.ReadLine();
  10. int p = int.Parse(Console.ReadLine()); // брой празници в година (без събота и неделя);
  11. int h = int.Parse(Console.ReadLine()); // брой уикенди, в които Влади си пътува до родния край;
  12.  
  13. int weekendSf = 48 - h; // Sofia weekends
  14. double totalGamesSf = weekendSf * (3.0/4.0); // sum of games in sofia
  15.  
  16. double totalGamesHome = h;
  17.  
  18. double totalGamesHolidays = p * (2.0/3.0); // 2/3 = 0.666666..;
  19.  
  20. double totalPlays = totalGamesSf + totalGamesHome + totalGamesHolidays;
  21.  
  22. if (year == "normal")
  23. {
  24. Console.WriteLine(Math.Floor(totalPlays));
  25. }
  26. else if (year == "leap")
  27. {
  28. double leapTotalPlays = totalPlays * 0.15;
  29. totalPlays += leapTotalPlays;
  30.  
  31. Console.WriteLine(Math.Floor(totalPlays));
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement