本地都没过,求助

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

应该是改成这样吧,从我这能[AC](https://www.luogu.com.cn/record/110168606) 几个问题: 1.`check`函数中的if条件有误 2.`if(sb==nb+1)nb=1;`改为`if(sb==nb+1)sb=1;` ```cpp #include<bits/stdc++.h> using namespace std; int check(int a,int b){ if(a==0){ if(b==2||b==3)return 1; if(b==1||b==4)return 2; return 0; } if(a==1){ if(b==0||b==3)return 1; if(b==2||b==4)return 2; return 0; } if(a==2){ if(b==1||b==4)return 1; if(b==0||b==3)return 2; return 0; } if(a==3){ if(b==2||b==4)return 1; if(b==0||b==1)return 2; return 0; } if(a==4){ if(b==0||b==1)return 1; if(b==2||b==3)return 2; return 0; } } int main(){ int n,na,nb,a[201],b[201],sa=1,sb=1,k[3]={0}; cin>>n>>na>>nb; for(int i=1;i<=na;i++)cin>>a[i]; for(int i=1;i<=nb;i++)cin>>b[i]; while(n--){ k[check(a[sa],b[sb])]++; sa++,sb++; if(sa==na+1)sa=1; if(sb==nb+1)sb=1; } cout<<k[1]<<" "<<k[2]; return 0; } ```
by Find_NICK @ 2023-05-12 21:20:36


唉,我自己手残,打错了\ 另:感谢大佬纠正
by liuyi0905 @ 2023-05-14 13:53:34


|