| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
新手参考,大神勿进题意:m个人,n顿饭,给出m个人在n顿饭中的出席情况,求:有没有人出席了全部饭局。
思路:一个人如果没有出席某一饭局,其他就不用判断了,符合 &
rt
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<string.h>
#include<algorithm>
#define N 101
using namespace std;
int s[N];
int main()
{
int i,j,m,n,t;
while(1)
{
scanf("%d%d",&m,&n);
if(m+n == 0) break;
memset(s,1,sizeof(s));
for(i=0;i<n;i++)
{
for(j=0;j<m;j++){
scanf("%d",&t);
s[j]&=t;
}
}
j=0;
for(i=0;i<m;i++)
if(s[i])j=1;
if(j)printf("yes\n");
else printf("no\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator