Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- using namespace std;
- int main(){
- int n, time;
- int curr;
- vector <int> data;
- cin >> n;
- for (int i=0; i<n; i++) {
- cin >> curr;
- data.push_back(curr);
- }
- for (int i = data.size() - 1; i>=0; i--) {
- if (i == 0) {
- if (time >= 3) cout << "True";
- else cout << "False";
- }
- else if (abs(data[i] - data[i-1]) <= 3) time++;
- else {
- if (time >= 3) cout << "True";
- else cout << "False";
- break;
- }
- //else if (data[i] < data[i-1]) {
- // if (time >= 3) cout << "True";
- // else cout << "False";
- // break;
- //}
- //else if (data[i] > data[i-1]) {
- // cout << "False";
- // break;
- //}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement