1 条评论
-
山相宸 @ 2024-7-6 13:26:36
#include //导入文件 using namespace std; int main() { int n =0; int a =0; int x=0,y =0; cin>>n; for (int i =1;i<=n;i++) { cin>>a; if (a==1)//0是没扣紧 1是扣紧 { x+=1;//x是扣紧 y是没扣进 } else { y+=1; }
} if (n == 1) { if (x == 1) { cout<<"YES"; } else { cout<<"NO"; } }
else if (y==1) { cout<<"YES"; } else { cout<<"NO"; }
return 0; }
- 1