这道题可以说想到简单,完全送分,暴力就好。下面是代码:
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int n,a[205],b[205],aa,ab,na,nb,k,l; int bi[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() { freopen("rps.in","r",stdin); freopen("rps.out","w",stdout); cin>>n>>na>>nb; for(int i=1;i<=na;i++) cin>>a[i]; for(int j=1;j<=nb;j++) cin>>b[j]; for(int i=na+1;i<=n;i++) { a[i]=a[i-na]; } for(int i=nb+1;i<=n;i++) { b[i]=b[i-nb]; } for(int i=1;i<=n;i++) { if(bi[a[i]][b[i]]==1)aa++; if(bi[a[i]][b[i]]==-1)ab++; } cout<<aa<<' '<<ab; return 0; }
清清正正射命丸文是也~