Saturday, 29 August 2015

UVALive 3470 Pascal Library (POJ 2864, Regionals 2005 >> Latin America - South America )

///     Raihan Ruhin
///     CSE, Jahangirnagar University.
///     Dhaka-Bangladesh.
///     id: raihanruhin (topcoder / codeforces / codechef / hackerrank / uva / uvalive / spoj), 3235 (lightoj)
///     mail: raihanruhin@ (yahoo / gmail / facebook)
///     blog: ruhinraihan.blogspot.com

#include<bits/stdc++.h>
using namespace std;

#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)

#define MOD 1000000007
#define MX 100010


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int tc, kk=1, n, d, sum[102], x;
    string s;
    char ch;
    while(cin>>n>>d && n)
    {
        CLR(sum);
        for(int i=1;i<=d;i++)
            for(int j=1;j<=n;j++)
            {
                cin>>x;
                sum[j]+=x;
            }
        bool chk=false;
        for(int i=1;i<=n;i++)
            if(sum[i]==d) chk=true;
        if(chk) cout<<"yes\n";
        else    cout<<"no\n";
    }
return 0;
}

No comments:

Post a Comment