【模拟】Codeforces 691A Fashion in Berland
2016-08-27 23:45
204 查看
题目链接:
http://codeforces.com/problemset/problem/691/A
题目大意:
n个数0或1,要求恰好n-1个1,如果n为1则那个数一定要是1
题目思路:
【模拟】
水题一道。看错题目两次。。
View Code
http://codeforces.com/problemset/problem/691/A
题目大意:
n个数0或1,要求恰好n-1个1,如果n为1则那个数一定要是1
题目思路:
【模拟】
水题一道。看错题目两次。。
// //by coolxxx //#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string> #include<iomanip> #include<map> #include<stack> #include<queue> #include<set> #include<bitset> #include<memory.h> #include<time.h> #include<stdio.h> #include<stdlib.h> #include<string.h> //#include<stdbool.h> #include<math.h> #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define abs(a) ((a)>0?(a):(-(a))) #define lowbit(a) (a&(-a)) #define sqr(a) ((a)*(a)) #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b)) #define mem(a,b) memset(a,b,sizeof(a)) #define eps (1e-8) #define J 10 #define mod 1000000007 #define MAX 0x7f7f7f7f #define PI 3.14159265358979323 #define N 1004 using namespace std; typedef long long LL; int cas,cass; int n,m,lll,ans; bool a ; int main() { #ifndef ONLINE_JUDGE // freopen("1.txt","r",stdin); // freopen("2.txt","w",stdout); #endif int i,j,k; // for(scanf("%d",&cass);cass;cass--) // for(scanf("%d",&cas),cass=1;cass<=cas;cass++) // while(~scanf("%s",s+1)) while(~scanf("%d",&n)) { for(i=1;i<=n;i++) scanf("%d",&a[i]); if(n==1) { if(a[1])puts("YES"); else puts("NO"); continue; } for(i=1,j=0;i<=n;i++) if(!a[i])j++; if(j!=1)puts("NO"); else puts("YES"); } return 0; } /* // // */
View Code
相关文章推荐
- codeforces 116A Tram(模拟水题)
- codeforces 266A Stones on the Table(模拟水题)
- CodeForces - 868B Race Against Time(模拟)
- codeforces 404B Marathon(模拟)
- Codeforces 706E Working routine (模拟链表)
- [codeforces] C - Efim and Strange Grade 模拟+贪心
- Codeforces 560B Gerald is into Art(相片摆放模拟)
- CodeForces--606A --Magic Spheres(模拟水题)
- CodeForces 606A-A. Magic Spheres【模拟】
- Codeforces 380C. Sereja and Brackets(模拟啊)
- 【STL】【模拟】Codeforces 696A Lorenzo Von Matterhorn
- CodeForces 471B MUH and Important Things 模拟 水
- CodeForces 641C Little Artem and Dance (模拟)
- Codeforces 793C Mice Problem 几何(模拟)
- 【并查集】【模拟】Codeforces 698B & 699D Fix a Tree
- CodeForces - 670D1 Magic Powder - 1 (模拟)
- Codeforces 350 Div2 E Correct Bracket Sequence Editor(list模拟)
- CodeForces - 673A Bear and Game (模拟)水
- 【模拟】Codeforces 710A King Moves
- Codeforces 841 Generous Kefa(模拟)