@[羊晴](/space/show?uid=167118)
你数组开小了,虽然数据范围是200没错
但是你是通过向后复制数组的方式,这样会导致r1 r2大于200然后导致数组越界了
by Bbaka @ 2019-08-18 10:11:55
@[IQZ_](/space/show?uid=138440)
对,是这个问题,感谢
by HDU_21041904 @ 2019-08-18 11:06:39
```c
#include<iostream>
using namespace std;
int judge[5][5]=
{
0,-1, 1, 1,-1,
1, 0,-1, 1,-1,
-1, 1, 0,-1, 1,
-1,-1, 1, 0, 1,
1, 1,-1,-1, 0
};
int main()
{
int N,Na,Nb;
cin>>N>>Na>>Nb;
int *A=new int[Na];
int *B=new int[Nb];
for(int i=0;i<Na;i++)
cin>>A[i];
for(int i=0;i<Nb;i++)
cin>>B[i];
int score_A=0;
int score_B=0;
for(int i=0;i<N;i++)
{
if(judge[A[i%Na]][B[i%Nb]]==1)
score_A++;
else if(judge[A[i%Na]][B[i%Nb]]==-1)
score_B++;
}
cout<<score_A<<' '<<score_B;
return 0;
}
```
by huangchao @ 2019-08-18 22:20:47