Please Help me: why i get WA test 1
Послано
XMAN 28 окт 2009 02:14
#include<math.h>
#include<stdio.h>
int main()
{
int t[100],n,m,i,j,tr[10010];
scanf("%d",&n);
scanf("%d",&m);
for(i=1;i<=m;i++)
{
scanf("%d",&t[i]);
}
for(i=1;i<=n;i++)
{
if(i<=t[1])
tr[i]=2;
else
{
for(j=1;j<=m;j++)
{
if(i>t[j])
{printf("hhhhhhhhhhhh %d %d %d \n",i,t[j], tr[i-t[j]]);
if(tr[i-t[j]]==2)
{tr[i]=1;
printf("hahaha\n");
break;
}
}
}
if(j==m+1)
tr[i]=2;
}
printf("%d %d\n",i,tr[i]);
}
printf("%d",tr[n]);
return 0;
}