POJ 2864 Pascal Library(水~)
来源:互联网 发布:鹊桥淘客群助手软件 编辑:程序博客网 时间:2024/05/19 16:37
Description
每行是一场晚宴,第i个数,1代表i参加了此次晚宴,0代表未参加。若至少有一个人参加了全部晚宴,则输出yes,否则no
Input
多组输入,每组用例第一行为两个整数n和d分别表示人数和晚宴数,之后d行每行是一场晚宴,第i个数,1代表i参加了此次晚宴,0代表未参加
Output
对于每组用例,若至少有一个人参加了全部晚宴,则输出yes,否则no
Sample Input
3 3
1 1 1
0 1 1
1 1 1
7 2
1 0 1 0 1 0 1
0 1 0 1 0 1 0
0 0
Sample Output
yes
no
Solution
水题
Code
#include<stdio.h>int main(){ int n,d,i,j,temp,res,a[505][105]; while(scanf("%d%d",&n,&d)&&n&&d) { res=0; for(i=0;i<d;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); for(i=0;i<n;i++) { temp=0; for(j=0;j<d;j++) temp+=a[j][i]; if(temp==d)//参加全部晚宴人数 res++; } if(res) printf("yes\n"); else printf("no\n"); } return 0;}
0 0
- POJ 2864 Pascal Library(水~)
- 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(某一个环节的值决定全局的值)
- 1286. Pascal Library
- poj2864 Pascal Library
- Sicily 1286. Pascal Library
- 1286. Pascal Library
- TOJ 2142.Pascal Library
- 尺取法模板 【pascal】(附poj 3061&poj 2739)
- poj 3378 pascal
- 《数据结构编程实验》 2.4.3Pascal Library
- POJ 2704 Pascal's Travels
- 编程之路
- Oeacle客户端连接配置注意点
- NYOJ 206 矩形的个数
- java常用设计模式
- 精通JavaScript开发课时20(JS事件基础)学习笔记
- POJ 2864 Pascal Library(水~)
- 如何让 Spring Boot 项目发布到 Tomcat 服务器
- python module package import
- 黑马程序员-类的封装,继承和多态
- BZOJ 2125 最短路.
- 包管理器bower
- OrderedStatic
- python 处理时间
- POJ 2871 A Simple Question of Chemistry(水~)