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(){
- long long int n, time;
- long long int curr;
- vector <long long int> data;
- bool is_sleep = false;
- cin >> n;
- for (long long int i=0; i<n; i++) {
- cin >> curr;
- data.push_back(curr);
- }
- for (long long int i = 0; i<data.size(); i++) {
- if (abs(data[i] - data[i-1]) <= 3) time++;
- else time = 0;
- if (time >= 3) is_sleep = true;
- else is_sleep = false;
- }
- if (is_sleep) cout << "True";
- else cout << "False";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement