Advertisement
OMEGAHEAD_MonkoX

Untitled

Oct 12th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. // int n;
  9. long long int a;
  10. string st, line;
  11. cin >> st;
  12. ifstream in(st);
  13. //fout.open(st);
  14. long long int x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, answ = 0, answ2 = 0, s = 0, t = 0;
  15. if (in.is_open()) {
  16. // cin >> n;
  17. // cout << t << endl;
  18. while (getline(in, line)) {
  19. if (t > 0) {
  20. //cout << line << endl;
  21. t++;
  22. // cout << t << endl;
  23. a = stoi(line);
  24. //cout << a + 1 << endl;
  25. if (t < 7)
  26. {
  27. //cin >> a;
  28. if (t - 2 == 0)
  29. {
  30. x1 = a;
  31. continue;
  32.  
  33. }
  34. if (t - 2 == 1)
  35. {
  36. x2 = a;
  37. continue;
  38. }
  39. if (t - 2 == 2)
  40. {
  41. x3 = a;
  42. continue;
  43. }
  44. if (t - 2 == 3)
  45. {
  46. x4 = a;
  47. continue;
  48. }
  49. if (t - 2 == 4)
  50. {
  51. x5 = a;
  52. continue;
  53. }
  54. }
  55. // cin >> a;
  56. if ((t - 1) % 5 == 1)
  57. {
  58. if (x1 % 2 == 0)
  59. ++answ;
  60. else
  61. ++answ2;
  62. x1 = a;
  63. if (x1 % 2 == 0)
  64. s += answ;
  65. else
  66. s += answ2;
  67.  
  68. }
  69. if ((t - 1) % 5 == 2)
  70. {
  71. if (x2 % 2 == 0)
  72. ++answ;
  73. else
  74. ++answ2;
  75. x2 = a;
  76. if (x2 % 2 == 0)
  77. s += answ;
  78. else
  79. s += answ2;
  80. }
  81. if ((t - 1) % 5 == 3)
  82. {
  83. if (x3 % 2 == 0)
  84. ++answ;
  85. else
  86. ++answ2;
  87. x3 = a;
  88. if (x3 % 2 == 0)
  89. s += answ;
  90. else
  91. s += answ2;
  92. }
  93. if ((t - 1) % 5 == 4)
  94. {
  95. if (x4 % 2 == 0)
  96. ++answ;
  97. else
  98. ++answ2;
  99. x4 = a;
  100. if (x4 % 2 == 0)
  101. s += answ;
  102. else
  103. s += answ2;
  104. }
  105. if ((t - 1) % 5 == 0)
  106. {
  107. if (x5 % 2 == 0)
  108. ++answ;
  109. else
  110. ++answ2;
  111. x5 = a;
  112. if (x5 % 2 == 0)
  113. s += answ;
  114. else
  115. s += answ2;
  116. }
  117. }
  118. else
  119. ++t;
  120. }
  121. }
  122. in.close();
  123.  
  124. cout << s;
  125. }
  126.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement