60分求助

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

``` #include <queue> #include <cstdio> #include <stdlib.h> #include <string.h> #include <math.h> #include <iostream> #include <stack> #include <algorithm> #define MIN(x,y) ((x)<(y)?(x) : (y)) #define MAX(x,y) ((x)>(y)?(x) : (y)) using namespace std; typedef long long ll; const int maxn=1e6+5; const ll INF=1e9; /*坚持不懈,无懈可击*/ /*中国有句古话,叫做置之死地而后生!*/ int a[50][50]; int b[1005]; int c[1005]; int A[1005]; int B[1005]; void restart() { memset(a,-1,sizeof(a)); for(int i=0;i<5;i++) a[i][i]=2; a[0][1]=0;a[0][2]=1;a[0][3]=1;a[0][4]=0; a[1][0]=1;a[1][2]=0;a[1][3]=1;a[1][4]=0; a[2][0]=0;a[2][1]=1;a[2][3]=0;a[2][4]=1; a[3][0]=0;a[3][1]=0;a[3][2]=1;a[3][4]=1; a[4][0]=1;a[4][1]=1;a[4][2]=0;a[4][3]=0;//手写打表我真牛、 } int main() { restart(); int n,t1,t2;//t1是小A scanf("%d%d%d",&n,&t1,&t2); for(int i=1;i<=t1;i++) scanf("%d",&b[i]); for(int i=1;i<=t2;i++) scanf("%d",&c[i]); for(int i=1;i<=n;i++) { if(i%t1==0) A[i]=b[t1]; else A[i]=b[i%t1]; if(i%t2==0) B[i]=c[t2]; else B[i]=c[i%t2]; } int sumA=0,sumb=0; for(int i=1;i<=n;i++) { int xa=A[i],xb=B[i]; if(a[xa][xb]==2) continue; else if(a[xa][xb]==1) sumA+=1; else if(a[xa][xb]==0) sumb+=1;//因为我们这是以小a的视角,如果输了,那肯定小b就赢了呀。 } printf("%d %d\n",sumA,sumb); return 0; } ``` ~~不用感谢~~
by todayfinish @ 2022-06-10 12:43:26


不让我谢我也谢
by JackHu0117 @ 2022-06-10 14:18:12


|