Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

新手参考,大神勿进

Posted by 2004140022 at 2015-12-10 11:17:16 on Problem 2864
题意: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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator