萌新30分求助。。调了很久很久 实在不知道哪里错了 :)
查看原帖
萌新30分求助。。调了很久很久 实在不知道哪里错了 :)
355276
清小秋ovo楼主2021/8/15 13:19

这是代码 (跟题解里的一篇非常像。。但是就是过不了,不知道哪里出毛病了)

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
#define PB push_back

int a[1000];
int b[1000];

//a是甲的分,b是乙的分
int a_count=0;
int b_count=0;
// 0是剪刀,1是石头,2是布,3是蜥蜴人,4是斯波克

void check(int x,int y){
    if(x==0 && y==1) b_count++;
    if(x==0 && y==2) a_count++;
    if(x==0 && y==3) a_count++;
    if(x==0 && y==4) b_count++;

    if(x==1 && y==0) a_count++;
    if(x==1 && y==2) b_count++;
    if(x==1 && y==3) a_count++;
    if(x==1 && y==4) b_count++;

    if(x==2 && y==0) b_count++;
    if(x==2 && y==1) a_count++;
    if(x==2 && y==3) b_count++;
    if(x==2 && y==4) a_count++;

    if(x==3 && y==0) b_count++;
    if(x==3 && y==1) b_count++;
    if(x==3 && y==2) a_count++;
    if(x==3 && y==4) a_count++;

    if(x==4 && y==0) b_count++;
    if(x==4 && y==1) b_count++;
    if(x==4 && y==2) a_count++;
    if(x==4 && y==3) a_count++;

    if(x==y) a_count+=0,b_count+=0;
}

int main()
{
   int a1=0;
   int b1=0;
   int n,na,nb;
   cin>>n>>na>>nb;
   for(int i=1;i<=na;i++) cin>>a[i];
   for(int i=1;i<=nb;i++) cin>>b[i];
   for(int z=1;z<=n;z++){
       a1++;
       b1++;
       if(a1>na) a1=1;
       if(b1>nb) b1=1;
       check(a[a1],b[b1]);
   }
   cout<<a_count<<" ";
   cout<<b_count<<endl;

}

2021/8/15 13:19
加载中...