题解 T784835 「LYHOI R4」Easy or Hard? Yes or No?
题目大意
(其实就是复制了题目)
给定一个长度为
- 令
t = a_1 ,随后对于\forall 2 \le i \le n ,a_{i-1} = a_i ,随后让a_n = t 。(就是把a_1 移到队尾) -
-
请你判断在经过了至多
解题思路
这道题第一眼看起来是不是很难?但是你再看看呢?当你已经使
看到这里你以为能 AC 了吗?如果这样想,恭喜你 WA 了。因为还有一种情况:
所以说,
AC 代码
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,a;
bool flag=0;//是否有正数
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a;
if(a>0) flag=1;
}
if(n==1/*特判!*/||flag==0) cout<<"Yes";
else cout<<"No";
return 0;
}