Codeforces 691A Fashion in Berland
2016-07-25 22:32
253 查看
水题。
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<stack> #include<iostream> using namespace std; typedef long long LL; const double pi = acos(-1.0), eps = 1e-8; void File() { freopen("D:\\in.txt", "r", stdin); freopen("D:\\out.txt", "w", stdout); } inline int read() { char c = getchar(); while (!isdigit(c)) c = getchar(); int x = 0; while (isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); } return x; } int n,a[1010],sz; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) {scanf("%d",&a[i]); if(a[i]==1) sz++;} if(n==1) { if(a[1]==1) printf("YES\n"); else printf("NO\n"); } else { if(sz!=n-1) printf("NO\n"); else printf("YES\n"); } return 0; }
相关文章推荐
- PAT 乙级1008. 数组元素循环右移问题 (JAVA版)
- css中的伪类与伪元素的区别
- 直接双击启动tomcat中的startup.bat闪退原因及解决方法
- 利用冒泡法实现一个随机数组中的元素排序
- python
- python 学习 (七) 循环嵌套
- java学习之路 之 基本语法-方法(函数)及练习题
- Java之国际化
- centos镜像文件下载地址
- python(二) N的阶乘对M取余
- 【ES6】变量的解构赋值
- STL面试题
- 2016.7.25 随记
- lamp+nfs+Samba实现wordpress博客
- CentOS下TFTP服务安装
- PHP进阶(一)——数组与函数
- swift-下拉刷新实现原理(附Demo)
- poj 2912 Rochambeau
- **MYSQL** 系列十二
- 洛谷 P1057 传球游戏