CF691A Fashion in Berland

题目描述
According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it should be the last one. Also if the jacket has only one button, it should be fastened, so the jacket will not swinging open.

You are given a jacket with nn buttons. Determine if it is fastened in a right way.

输入格式
The first line contains integer nn ( 1<=n<=10001<=n<=1000 ) — the number of buttons on the jacket.

The second line contains nn integers a_{i}a
i

( 0<=a_{i}<=10<=a
i

<=1 ). The number a_{i}=0a
i

=0 if the ii -th button is not fastened. Otherwise a_{i}=1a
i

=1 .

输出格式
In the only line print the word “YES” if the jacket is fastened in a right way. Otherwise print the word “NO”.

题意翻译
根据伯兰德时装的规则,夹克除了一个钮扣外,所有的钮扣都应该扣紧,但不一定是最后一个。另外,如果夹克只有一个按钮,它应该紧固,这样夹克就不会摆动打开。

给你一件纽扣的夹克。确定它是否以正确的方式固定。

输入输出格式:

输入格式:

第一行包含整数n(1<=n<=10001<=n<=1000),n是外套上的按钮数。

第二行包含n个整数a i。如果第i个按钮没有紧固,则数字a[i]=0。否则a[i]=0。

输出格式:

输出只有一行。如果夹克是正确的方式紧固,在一行内输出“是”。否则输出“不”字。

输入输出样例

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值