POJ 2864 - Pascal Library
来源:互联网 发布:xfplay 怎么没有mac版 编辑:程序博客网 时间:2024/06/10 19:22
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5111 Accepted: 2450
Description
Pascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building started to show the effects of supporting the weight of the enormous amount of books it houses.
To help in the renovation, the Alumni Association of the University decided to organize a series of fund-raising dinners, for which all alumni were invited. These events proved to be a huge success and several were organized during the past year. (One of the reasons for the success of this initiative seems to be the fact that students that went through the Pascal system of education have fond memories of that time and would love to see a renovated Pascal Library.)
The organizers maintained a spreadsheet indicating which alumni participated in each dinner. Now they want your help to determine whether any alumnus or alumna took part in all of the dinners.
To help in the renovation, the Alumni Association of the University decided to organize a series of fund-raising dinners, for which all alumni were invited. These events proved to be a huge success and several were organized during the past year. (One of the reasons for the success of this initiative seems to be the fact that students that went through the Pascal system of education have fond memories of that time and would love to see a renovated Pascal Library.)
The organizers maintained a spreadsheet indicating which alumni participated in each dinner. Now they want your help to determine whether any alumnus or alumna took part in all of the dinners.
Input
The input contains several test cases. The first line of a test case contains two integers N and D indicating respectively the number of alumni and the number of dinners organized (1 <= N <= 100 and 1 <= D <= 500). Alumni are identified by integers from 1 to N. Each of the next D lines describes the attendees of a dinner, and contains N integers Xi indicating if the alumnus/alumna i attended that dinner (Xi = 1) or not (Xi = 0). The end of input is indicated by N = D = 0.
Output
For each test case in the input your program must produce one line of output, containing either the word `yes', in case there exists at least one alumnus/alumna that attended all dinners, or the word `no' otherwise.
Sample Input
3 31 1 10 1 11 1 17 21 0 1 0 1 0 10 1 0 1 0 1 00 0
Sample Output
yesno
Hint
Alumna: a former female student of a particular school, college or university.
Alumnus: a former male student of a particular school, college or university.
Alumni: former students of either sex of a particular school, college or university.
Alumnus: a former male student of a particular school, college or university.
Alumni: former students of either sex of a particular school, college or university.
Source
South America 2005
判定方法可以是通过每一列的相加是否等于总举办晚宴次数
#include <iostream>#include <cstring>using namespace std;int a[500][100];int counts;int flag;int main(){memset(a,0,sizeof(a));int n,d;while(cin>>n>>d,n&&d){for(int i=0;i<d;i++)for(int j=0;j<n;j++){cin>>a[i][j];}for(int i=0;i<n;i++){flag=0;counts=0;for(int j=0;j<d;j++)flag+=a[j][i];if(flag==d){counts=1;break;}}if(counts)cout<<"yes"<<endl;else cout<<"no"<<endl;}return 0;}
0 0
- poj 2864 Pascal Library
- POJ 2864 - Pascal Library
- POJ 2864 Pascal Library 水
- POJ 2864 Pascal Library G++
- POJ 2864 Pascal Library(水~)
- POJ-2864 Pascal Library-年年参加聚会
- Pascal Library
- (简单模拟2.4.3)POJ 2864 Pascal Library(某一个环节的值决定全局的值)
- POJ 2864 Pascal Library(我的水题之路——都来了么)
- 1286. Pascal Library
- poj2864 Pascal Library
- Sicily 1286. Pascal Library
- 1286. Pascal Library
- TOJ 2142.Pascal Library
- poj 3378 pascal
- 《数据结构编程实验》 2.4.3Pascal Library
- POJ 2704 Pascal's Travels
- poj 3368 (线段树pascal)
- 黑马程序员 java高新技术之增强for循环
- iOS学习之iOS沙盒(sandbox)机制和文件操作之NSFileManager(三)
- C++类库
- 2014我的读书指南
- 断言(ASSERT)的用法
- POJ 2864 - Pascal Library
- 成为合格管理者的几个关键词
- 关于网卡和路由之类的
- Java多线程系列--“基础篇”09之 interrupt()和线程终止方式
- 新的互联网是什么样子?
- java 多线程
- Android中Yahoo天气预报API的使用
- 黑马程序员-传智播客资料中的面试题
- gcd算法整合(最大公约数)