Codeforces691A【读题-水】

妈蛋wa了两次。。
时尚的定义是length大于1的要破个洞,一定要破个洞。。
According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one

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

typedef __int64 LL;
const int N=1e3+10;
int a[N];
int n,sum;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    if(n==1)
    {
        if(a[1]==1)
            puts("YES");
        else
            puts("NO");
        return 0;
    }
    sum=0;
    for(int i=1;i<=n;i++)
        if(!a[i])
            sum++;
    if(sum!=1)
        puts("NO");
    else
        puts("YES");
    return 0;
}
原文地址:https://www.cnblogs.com/keyboarder-zsq/p/5934790.html