Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main() {
- // int n;
- long long int a;
- string st, line;
- cin >> st;
- ifstream in(st);
- //fout.open(st);
- long long int x1 = 0, x2 = 0, x3 = 0, x4 = 0, x5 = 0, answ = 0, answ2 = 0, s = 0, t = 0;
- if (in.is_open()) {
- // cin >> n;
- // cout << t << endl;
- while (getline(in, line)) {
- if (t > 0) {
- //cout << line << endl;
- t++;
- // cout << t << endl;
- a = stoi(line);
- //cout << a + 1 << endl;
- if (t < 7)
- {
- //cin >> a;
- if (t - 2 == 0)
- {
- x1 = a;
- continue;
- }
- if (t - 2 == 1)
- {
- x2 = a;
- continue;
- }
- if (t - 2 == 2)
- {
- x3 = a;
- continue;
- }
- if (t - 2 == 3)
- {
- x4 = a;
- continue;
- }
- if (t - 2 == 4)
- {
- x5 = a;
- continue;
- }
- }
- // cin >> a;
- if ((t - 1) % 5 == 1)
- {
- if (x1 % 2 == 0)
- ++answ;
- else
- ++answ2;
- x1 = a;
- if (x1 % 2 == 0)
- s += answ;
- else
- s += answ2;
- }
- if ((t - 1) % 5 == 2)
- {
- if (x2 % 2 == 0)
- ++answ;
- else
- ++answ2;
- x2 = a;
- if (x2 % 2 == 0)
- s += answ;
- else
- s += answ2;
- }
- if ((t - 1) % 5 == 3)
- {
- if (x3 % 2 == 0)
- ++answ;
- else
- ++answ2;
- x3 = a;
- if (x3 % 2 == 0)
- s += answ;
- else
- s += answ2;
- }
- if ((t - 1) % 5 == 4)
- {
- if (x4 % 2 == 0)
- ++answ;
- else
- ++answ2;
- x4 = a;
- if (x4 % 2 == 0)
- s += answ;
- else
- s += answ2;
- }
- if ((t - 1) % 5 == 0)
- {
- if (x5 % 2 == 0)
- ++answ;
- else
- ++answ2;
- x5 = a;
- if (x5 % 2 == 0)
- s += answ;
- else
- s += answ2;
- }
- }
- else
- ++t;
- }
- }
- in.close();
- cout << s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement