poj2864

    技术2024-08-23  43

    //at least one  that attended ALL dinners//X indicating if attended that dinner (X = 1) or not (X = 0).

    #include "stdafx.h"#include <stdio.h>

    int a[500][100];

    void compare(int number,int dinner){ int i,j; int flag = 0; int count =0;

     for(i=0;i<dinner;i++) {  for(j=0;j<number;j++)   scanf("%d",&a[i][j]); }

     for(i=0;i<number;i++) {  count = 0;  for(j=0;j<dinner;j++)  {   if(a[j][i] == 1)   {    count++;    if(count == dinner)    {     flag = 1;     break;    }   }  } }

      if(flag == 1)   printf("yes/n");  else   printf("no/n");

    }

     

    int main(){  int number,dinner;  while(1) {  scanf("%d %d",&number,&dinner);  if(number ==0 && dinner == 0)   break;

      compare(number,dinner); }

     return 0;}

     

    最新回复(0)