zoukankan      html  css  js  c++  java
  • Pascal Library

    Total Submissions: 5204   Accepted: 2481

    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 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

    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.

    Source

    South America 2005

    #include <iostream>
    using namespace std;
    int main()
    {int a[1000][1000];
    int a1,a2,t,sum,i,j;
    while(scanf("%d %d",&a1,&a2)!=EOF)
    {if(a1==0)break;
        t=0;
    for(i=0;i<a2;i++)
    for(j=0;j<a1;j++)
    cin>>a[i][j];
    for(i=0;i<a1;i++)
    {    sum=0;
        for(j=0;j<a2;j++)
        sum=a[j][i]+sum;
        if(sum==a2){t=1;break;}

    }


    if(t==1)
    printf("yes ");
    else printf("no ");

    }
    return 0;}

    开大数组
  • 相关阅读:
    .NET Core 中依赖注入 AutoMapper 小记
    40款用于简洁网页设计的光滑英文字体【上】
    AOS – 另外一个独特的页面滚动动画库(CSS3)
    分享20个新颖的字体设计草图,带给你灵感
    Cleave.js – 自动格式化表单输入框的文本内容
    CssStats – 分析和优化网站 CSS 代码的利器
    20款 JavaScript 开发框架推荐给前端开发者
    12个用于网站性能优化的最佳的图片压缩工具
    16款最佳的 jQuery Time Picker 时间选择插件
    2016年6月份那些最实用的 jQuery 插件专辑
  • 原文地址:https://www.cnblogs.com/lengxia/p/4387841.html
Copyright © 2011-2022 走看看