WA30分求助!

P1328 [NOIP2014 提高组] 生活大爆炸版石头剪刀布

``` #include<bits/stdc++.h> using namespace std; int n,numa,numb,a[205],b[205]; int main(){ cin>>n>>numa>>numb; //我习惯数组从1开始 for(int i=1;i<=numa;i++) cin>>a[i]; for(int i=1;i<=numb;i++) cin>>b[i]; int nowa=0,nowb=0;//赋值0 int ansa=0,ansb=0; while(n--) { //增加 nowa++; nowb++; //特判 if(nowa==numa+1) nowa=1; if(nowb==numb+1) nowb=1; if(a[nowa]==0) { if(b[nowb]==2||b[nowb]==3) ansa++; else if(b[nowb]==1||b[nowb]==4) ansb++; } else if(a[nowa]==1) { if(b[nowb]==0||b[nowb]==3) ansa++; else if(b[nowb]==2||b[nowb]==4) ansb++; } else if(a[nowa]==2) { if(b[nowb]==1||b[nowb]==4) ansa++;//1,4 else if(b[nowb]==0||b[nowb]==3) ansb++;//0,3 } else if(a[nowa]==3) { if(b[nowb]==2||b[nowb]==4) ansa++; else if(b[nowb]==0||b[nowb]==1) ansb++; } else { if(b[nowb]==0||b[nowb]==1) ansa++;//0,1 else if(b[nowb]==2||b[nowb]==3) ansb++;//2,3 } } cout<<ansa<<" "<<ansb; return 0; } ``` 累死我了,点个关注吧。
by 123456789dd @ 2023-08-06 14:21:02


@[123456789dd](/user/1043825) 过啦谢谢
by sunyining28 @ 2023-08-08 16:35:31


|