30 lines
505 B
C++
30 lines
505 B
C++
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
ios::sync_with_stdio(0);
|
||
|
cin.tie(0);
|
||
|
|
||
|
int total = 0;
|
||
|
string line;
|
||
|
while (getline(cin, line) && !line.empty()) {
|
||
|
istringstream l(line);
|
||
|
vector<int> t;
|
||
|
while (!l.eof()) {
|
||
|
int x;
|
||
|
l >> x;
|
||
|
t.push_back(x);
|
||
|
}
|
||
|
int pos = (t[1] > t[0]) ? 1 : -1;
|
||
|
for (int i = 0; i < t.size() - 1; i++) {
|
||
|
int diff = (t[i + 1] - t[i]) * pos;
|
||
|
if (diff < 1 || diff > 3) {
|
||
|
goto next;
|
||
|
}
|
||
|
}
|
||
|
total++;
|
||
|
next:;
|
||
|
}
|
||
|
cout << total << '\n';
|
||
|
}
|