Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Last active August 29, 2015 14:17
Show Gist options
  • Save shohan4556/dd5481a1fc10f7d4e105 to your computer and use it in GitHub Desktop.
Save shohan4556/dd5481a1fc10f7d4e105 to your computer and use it in GitHub Desktop.
URI OJ : 1267 (Pascal Library) solution
/// URI OJ : 1267 (Pascal Library)
/// Author : Shohanur Rahaman
/// Probem Type : Ad-Hoc
#include<stdio.h>
int main()
{
int i,j,tmp,ck;
int ara[500][500];
int d,n;
while(scanf("%d %d",&n,&d)==2){
if(n==0 && d==0)
break;
for(j=0;j<d;j++){
for(i=0;i<n;i++){
scanf("%d",&ara[j][i]);
}
}
ck=0;
tmp=0;
for(i=0;i<n;i++){
tmp=0;
for(j=0;j<d;j++){
tmp=tmp+ara[j][i];
if(tmp==d){
ck=1;
break;
}
}
}
if(ck==1)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment