---
# System prepended metadata

title: A. Walking Boy
tags: [Codeforces]

---

<style>
    html, body, .ui-content {
    background: #222222;
    color: #00BFFF;
}
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2BE8CF60 0%, #2B83E860 100%);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2BE8CF95 0%, #2B83E895 100%);
}
    /* 設定 code 模板 */
    .markdown-body code,
.markdown-body tt {
    background-color: #ffffff36;
}
.markdown-body .highlight pre,
.markdown-body pre {
    color: #ddd;
    background-color: #00000036;
}
.hljs-tag {
    color: #ddd;
}
.token.operator {
  background-color: transparent;
}
   
</style>

###### tags: `Codeforces`

# A. Walking Boy

## 題目
###### Link : https://codeforces.com/contest/1776/problem/A


## 程式碼

```cpp=
#include <bits/stdc++.h>
using namespace std;

int main() {
    int Case;
    cin >> Case;
    while (Case--) {
        int mess, cnt = 0, temp, temp2;
        cin >> mess;
        cin >> temp;
        //從0到第一個時間可以遛狗的次數
        cnt += temp / 120;
        for (int i = 1; i < mess; ++i) {
            cin >> temp2;
            //每次的間格可以遛狗的次數
            cnt += (temp2 - temp) / 120;
            temp = temp2;
        }
        //最後一個時間到1440可以遛狗的次數
        cnt += (1440 - temp2) / 120;
        if (cnt >= 2 || mess < 2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}
```