博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj2864 Pascal Library
阅读量:2441 次
发布时间:2019-05-10

本文共 2358 字,大约阅读时间需要 7 分钟。

Pascal Library
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 5445   Accepted: 2610

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.

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.

题意:统计二维矩阵的列中出现1的个数,如果个数等于列数,就输出yes,否则输出no!

参考代码:

#include 
using namespace std;int map[101][501];int main(){ int m,n; while (cin>>m>>n){ if (m==0&&n==0) continue; int flag=0; for (int i=0;i
>map[i][j]; if (map[i][j]==1) num++; } if (num==n){ flag=1; } } if (flag==1) cout<<"yes"<

转载地址:http://ofbqb.baihongyu.com/

你可能感兴趣的文章
RedHat Linux 9下所有权和许可权限(转)
查看>>
C++程序设计从零开始之语句(转)
查看>>
利用Apache+PHP3+MySQL建立数据库驱动的动态网站(转)
查看>>
C#中实现DataGrid双向排序(转)
查看>>
利用C语言小程序来解决大问题(转)
查看>>
简单方法在C#中取得汉字的拼音的首字母(转)
查看>>
.NET开发之中的17种正则表达式小结(转)
查看>>
编程秘籍:使C语言高效的四大绝招(转)
查看>>
配置XDM--一种Linux的图形登录界面(转)
查看>>
计算机加锁 把U盘变成打开电脑的钥匙(转)
查看>>
C#开发的两个基本编程原则的深入讨论(转)
查看>>
Fedora Core 4 基础教程 (上传完毕)(转)
查看>>
删除MSSQL危险存储过程的代码(转)
查看>>
红旗软件:树立国际的Linux品牌(转)
查看>>
Linux学习要点(转)
查看>>
影响mysqld安全的几个选项(转)
查看>>
最新版本Linux Flash 9 Beta开放发布(转)
查看>>
mysql事务处理(转)
查看>>
Fedora 显示设备配置工具介绍(转)
查看>>
FREEBSD 升级及优化全攻略(转)
查看>>