Codeforces 691A. Fashion in Berland (模拟)
来源:互联网 发布:数据库订单管理模板 编辑:程序博客网 时间:2024/06/07 16:53
题目链接
简单题意
给一串0和1,要求有且只有一个0,如果只有一个数,则必须为1
思路
简单模拟就好
Python大法好~~~
代码
Python
print('YES' if min(1,int(input())-1) == input().split().count('0') else 'NO')
CPP
#include <bits/stdc++.h>using namespace std;int main (){ int n,m,sum = 0; cin >> n; for(int i = 0 ; i < n ; i ++){ cin >> m; sum += m; } if(n-sum == min(1,n-1)) puts("YES"); else puts("NO"); return 0;}
0 0
- 【模拟】Codeforces 691A Fashion in Berland
- Codeforces 691A. Fashion in Berland (模拟)
- Fashion in Berland
- CodeForces 370 B.Berland Bingo(模拟)
- Codeforces 25CRoads in Berland(floyed)
- codeforces 370B Berland Bingo(强势模拟)
- Codeforces #375(Div.2)D. Lakes in Berland【Bfs】
- CodeForces 723D-Lakes in Berland(BFS DFS)
- CodeForces 638 B.Making Genome in Berland(水~)
- Codeforces-723D- Lakes in Berland(DFS)
- Codeforces 846E Chemistry in Berland(防爆long long)
- CodeForces 644 A.Parliament of Berland(构造)
- CodeForces-719A. Vitya in the Countryside(模拟)
- CodeForces 825B:Five-In-a-Row(模拟)
- codeforces 691A 模拟
- codeforces 25C. Roads in Berland
- CodeForces 25CRoads in Berland【floyd过】
- CodeForces 25C Roads in Berland
- 502款开源iOS应用的开源项目
- 关于platform_led驱动的问题
- Identity Mappings in Deep Residual Networks
- How to enter an End-Of-File from the keyboard
- pinyin4j
- Codeforces 691A. Fashion in Berland (模拟)
- java中的内部类
- 树(1)把二叉查找树转换成有序的双向链表
- hdu 5154 Harry and Magical Computer(拓扑排序)
- Java_JVM_逃逸分析技术_栈上分配_标量替换
- 相对布局属性讲解
- 高可用集群的概念理解
- 构造数组的MaxTree
- php set get asset unset