Advertisement
viraco4a

4_Make_it_Rain

Jan 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MakeItRain
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int N = int.Parse(Console.ReadLine());
  14. List<int[]> AllTriplets = GetTriplets(N);
  15. int TCounter = 0;
  16. int FCounter = 0;
  17. int ASCII_T = 84;
  18. int ASCII_F = 70;
  19. foreach (int[] Triplet in AllTriplets)
  20. {
  21. if (Triplet[1] != 0)
  22. {
  23. if (Triplet[0] / Triplet[1] == Triplet[2])
  24. {
  25. TCounter += ASCII_T;
  26. FCounter /= (ASCII_T / 10);
  27. }
  28. else
  29. {
  30. FCounter += ASCII_F;
  31. TCounter /= (ASCII_F / 10);
  32. }
  33. }
  34. else if (Triplet[1] == 0)
  35. {
  36. FCounter += ASCII_F;
  37. TCounter /= (ASCII_F / 10);
  38. }
  39. }
  40.  
  41. bool rain = false;
  42. if (FCounter == 0)
  43. {
  44. rain = false;
  45. }
  46. else
  47. {
  48. int Divition = TCounter / FCounter;
  49. if (Divition % 2 == 0)
  50. {
  51. rain = true;
  52. }
  53. }
  54. Console.WriteLine($"T: {TCounter}");
  55. Console.WriteLine($"F: {FCounter}");
  56. Console.WriteLine($"Got a Roin coin: {rain}");
  57. }
  58.  
  59. private static List<int[]> GetTriplets(int N)
  60. {
  61. List<int[]> AllTriplets = new List<int[]>();
  62. for (int j = 0; j < N; j++)
  63. {
  64. int[] newTriplet = new int[3];
  65. for (int i = 0; i < 3; i++)
  66. {
  67. newTriplet[i] = int.Parse(Console.ReadLine());
  68. }
  69. AllTriplets.Add(newTriplet);
  70. }
  71.  
  72. return AllTriplets;
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement