![:x](./images/smilies/icon_mad.gif)
I had consider about the overflow problem, and use long long to store some variable.
world anyone can point out that where is my mistaker, please??
![:oops:](./images/smilies/icon_redface.gif)
[c]
#include <stdio.h>
int main()
{
long long total,tmp;
int num,n,b,k,box;
scanf("%d",&num);
while(num-->0)
{
scanf("%d %d",&n,&b);
total=0;
while(b-->0)
{
tmp=1;
scanf("%d",&k);
while(k-->0)
{
scanf("%d",&box);
tmp*=box;
}
total+=tmp;
}
printf("%lld\n",total%n);
}
return 0;
}
[/c]