58 条题解

  • 5
    @ 2016-11-14 20:00:00
    #include <iostream>   
    using namespace std;  
    int map[5][5]={0,0,1,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1,0,0,0}; 
    int a[200],b[200];
    using namespace std;
    int main()
    {
        int n,na,nb,i,j,sumA=0,sumB=0,pin=0;
        cin>>n>>na>>nb;
        for(i=0;i<na;i++)   cin>>a[i];
        for(i=0;i<nb;i++)   cin>>b[i];
        for(i=0;i<n;i++)
        {
            sumA+=map[a[i%na]][b[i%nb]];
            sumB+=map[b[i%nb]][a[i%na]];    
        }
        cout<<sumA<<" "<<sumB;
        return 0;
    }
    
  • 4
    @ 2017-07-20 19:17:15

    g[i][j]表示i对j的得分情况,把表抄过来就好(然而表抄错了好几次,尴尬...)

    #include<iostream>
    
    using namespace std;
    
    int n, na, nb;
    int a[201], b[201], ansa, ansb;
    int g[5][5] = {{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}};
    
    int main(){
        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 i = 1; i <= n; i++){
            int ia = i, ib = i;
            while(ia > na)  ia -= na;
            while(ib > nb)  ib -= nb;
            ansa += g[a[ia]][b[ib]];
            ansb += g[b[ib]][a[ia]];
        }
        cout << ansa << " " << ansb;
        return 0;
    }
    
  • 2
    @ 2017-10-08 21:55:29

    简单的模拟ヾ(o◕∀◕)ノ

    #include<iostream>
    using namespace std;
    int main()
    {
        int a[205],b[205];
        int n,na,nb,k=0,l=0,re1=0,re2=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];
         for(int i=1;i<=n;++i)
         {
            k++;
            l++;
            if(k==na+1)
            k=1;
            if(l==nb+1)
            l=1;
            if(a[k]==0)
            {
                if(b[l]==1)
                re2++;
                if(b[l]==2)
                re1++;
                if(b[l]==3)
                re1++;
                if(b[l]==4)
                re2++;
            }
            if(a[k]==1)
            {
                if(b[l]==0)
                re1++;
                if(b[l]==2)
                re2++;
                if(b[l]==3)
                re1++;
                if(b[l]==4)
                re2++;
            }
            if(a[k]==2)
            {
                if(b[l]==0)
                re2++;
                if(b[l]==1)
                re1++;
                if(b[l]==3)
                re2++;
                if(b[l]==4)
                re1++;
            }
            if(a[k]==3)
            {
                if(b[l]==0)
                re2++;
                if(b[l]==1)
                re2++;
                if(b[l]==2)
                re1++;
                if(b[l]==4)
                re1++;
            }
            if(a[k]==4)
            {
                if(b[l]==0)
                re1++;
                if(b[l]==1)
                re1++;
                if(b[l]==2)
                re2++;
                if(b[l]==3)
                re2++;
            }
         }
         cout<<re1<<" "<<re2;
         return 0;
    }
    
  • 1
    @ 2018-01-03 14:49:14
    #include<cstdio>
    int n, na, nb, sa, sb;
    int a[205], b[205], s[5][5];
    int main() {
        scanf("%d%d%d", &n, &na, &nb);
        for(int i=0; i<na; i++) scanf("%d", &a[i]);
        for(int i=0; i<nb; i++) scanf("%d", &b[i]);
        for(int i=na; i<n; i++) a[i]=a[i%na];
        for(int i=nb; i<n; i++) b[i]=b[i%nb];
        s[0][2]=1;
        s[0][3]=1;
        s[1][0]=1;
        s[1][3]=1;
        s[2][1]=1;
        s[2][4]=1;
        s[3][2]=1;
        s[3][4]=1;
        s[4][0]=1;
        s[4][1]=1;
        for(int i=0; i<n; i++) {
            sa+=s[a[i]][b[i]];
            sb+=s[b[i]][a[i]];
        }
        printf("%d %d",sa, sb);
        return 0;
    }
    
  • 1
    @ 2017-10-09 23:19:06

    第一次十分玄学的WA了,但稍微一改变量名马上就AC了....玄学事件....

    #include<iostream>
    #include<cstdio>
    using namespace std;
    int win[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 i,j,ans1,ans2,na,nb;
    int n,a[202],b[202];
    int main()
    {
        cin>>n>>na>>nb;
        for(i=1;i<=na;i++)
        {
            cin>>a[i];
        }
        for(j=1;j<=nb;j++)
        {
            cin>>b[j];
        }
        for(i=1;i<=n;i++)
        {
            a[i+na]=a[i];
            b[i+nb]=b[i];
            if(win[a[i]][b[i]]==1)
            {
                ans1++;
            }
            if(win[a[i]][b[i]]==-1)
            {
                ans2++;
            }
        }
        cout<<ans1<<" "<<ans2;
        return 0;
     } 
    
  • 1
    @ 2017-10-01 22:10:43
    #include <cmath>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <iomanip>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <deque>
    #include <set>
    #include <limits>
    #include <string>
    #include <sstream>
    using namespace std;
    
    const int oo_min=0xcfcfcfcf,oo_max=0x3f3f3f3f;
    
    int n,na,nb,ansa,ansb;
    int a[200+1];
    #define a(x) a[(x-1)%na+1]
    int b[200+1];
    #define b(x) b[(x-1)%nb+1]
    int c[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()
    {
        while (~scanf("%d%d%d",&n,&na,&nb))
        {
            for (int i=1;i<=na;i++)
                scanf("%d",&a(i));
            for (int i=1;i<=nb;i++)
                scanf("%d",&b(i));
            ansa=ansb=0;
            for (int i=1;i<=n;i++)
                if (c[a(i)][b(i)]==1)
                    ansa++;
                else if (c[a(i)][b(i)]==-1)
                    ansb++;
            printf("%d %d\n",ansa,ansb);
        }
    }
    
  • 1
    @ 2017-08-19 18:48:32

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<queue>
    #include<set>
    #include<ios>
    #include<string>
    #include<ctime>
    #include<cstdlib>
    #include<algorithm>
    #include<stdio.h>
    using namespace std;
    int a[201],b[201];
    int main()
    {
    int n,na,nb,A=0,B=0,x=1,y=1;
    scanf("%d%d%d",&n,&na,&nb);
    for(int i=1;i<=na;i++)
    {
    scanf("%d",&a[i]);
    }
    for(int j=1;j<=nb;j++)
    {
    scanf("%d",&b[j]);
    }

    for(int k=1;k<=n;k++)
    {
    if(x>nb)
    {
    x=1;
    }
    if(y>na)
    {
    y=1;
    }
    if(a[y]==0)
    {
    if(b[x]==1||b[x]==4)
    {
    B++;
    }
    if(b[x]==2||b[x]==3)
    {
    A++;
    }
    }
    if(a[y]==1)
    {
    if(b[x]==2||b[x]==4)
    {
    B++;
    }

    if(b[x]==3||b[x]==0)
    {
    A++;
    }

    }
    if(a[y]==2)
    {
    if(b[x]==3||b[x]==0)
    {
    B++;
    }
    if(b[x]==4||b[x]==1)
    {
    A++;
    }

    }
    if(a[y]==3)
    {

    if(b[x]==4||b[x]==2)
    {
    A++;
    }
    if(b[x]==1||b[x]==0)
    {
    B++;
    }
    }
    if(a[y]==4)
    {
    if(b[x]==0||b[x]==1)
    {
    A++;
    }
    if(b[x]==2||b[x]==3)
    {
    B++;
    }
    }
    x++;
    y++;
    }
    printf("%d %d",A,B);
    return 0;
    }

  • 1
    @ 2017-07-21 09:31:46

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<queue>
    #include<iostream>
    using namespace std;
    int a[201],b[201];
    int main()
    {
    int n,s=0,t=0,na,nb;
    scanf("%d%d%d",&n,&na,&nb);
    for(int j=1;j<=na;j++) scanf("%d",&a[j]);
    for(int k=1;k<=nb;k++) scanf("%d",&b[k]);
    for(int i=1;i<=n;i++)
    {
    if(i>na) a[i]=a[i-na];
    if(i>nb) b[i]=b[i-nb];
    if(a[i]==0&&(b[i]==2||b[i]==3))
    s++;
    if(a[i]==1&&(b[i]==0||b[i]==3))
    s++;
    if(a[i]==2&&(b[i]==4||b[i]==1))
    s++;
    if(a[i]==3&&(b[i]==2||b[i]==4))
    s++;
    if(a[i]==4&&(b[i]==0||b[i]==1))
    s++;////////////////
    if(a[i]==0&&(b[i]==1||b[i]==4))
    t++;
    if(a[i]==1&&(b[i]==2||b[i]==4))
    t++;
    if(a[i]==2&&(b[i]==0||b[i]==3))
    t++;
    if(a[i]==3&&(b[i]==0||b[i]==1))
    t++;
    if(a[i]==4&&(b[i]==2||b[i]==3))
    t++;

    }
    printf("%d %d",s,t);
    return 0;
    }

  • 1
    @ 2017-07-21 09:31:22

    太激动了!终于对了一个题。
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<queue>
    #include<iostream>
    using namespace std;
    int a[201],b[201];
    int main()
    {
    int n,s=0,t=0,na,nb;
    scanf("%d%d%d",&n,&na,&nb);
    for(int j=1;j<=na;j++) scanf("%d",&a[j]);
    for(int k=1;k<=nb;k++) scanf("%d",&b[k]);
    for(int i=1;i<=n;i++)
    {
    if(i>na) a[i]=a[i-na];
    if(i>nb) b[i]=b[i-nb];
    if(a[i]==0&&(b[i]==2||b[i]==3))
    s++;
    if(a[i]==1&&(b[i]==0||b[i]==3))
    s++;
    if(a[i]==2&&(b[i]==4||b[i]==1))
    s++;
    if(a[i]==3&&(b[i]==2||b[i]==4))
    s++;
    if(a[i]==4&&(b[i]==0||b[i]==1))
    s++;////////////////
    if(a[i]==0&&(b[i]==1||b[i]==4))
    t++;
    if(a[i]==1&&(b[i]==2||b[i]==4))
    t++;
    if(a[i]==2&&(b[i]==0||b[i]==3))
    t++;
    if(a[i]==3&&(b[i]==0||b[i]==1))
    t++;
    if(a[i]==4&&(b[i]==2||b[i]==3))
    t++;

    }
    printf("%d %d",s,t);
    return 0;
    }

  • 0
    @ 2020-04-07 20:05:48
    #include <iostream>         // [2014提高组Day1-A]生活大爆炸版石头剪刀布
    #include <algorithm>
    using namespace std;
    const int MAXN = 202;
    
    int A[MAXN], B[MAXN];
    int rule[5][5] = {
        0, 0, 1, 1, 0,
        1, 0, 0, 1, 0,
        0, 1, 0, 0, 1,
        0, 0, 1, 0, 1,
        1, 1, 0, 0, 0};
    
    int main()
    {
        int N, NA, NB, ansA = 0, ansB = 0;
        cin >> N >> NA >> NB;
        for (int i = 0; i < NA; i++)
            cin >> A[i];
        for (int i = 0; i < NB; i++)
            cin >> B[i];
    
        int a = 0, b = 0;
        for (int i = 0; i < N; i++)
        {
            ansA += rule[A[a]][B[b]];
            ansB += rule[B[b]][A[a]];
            a = (a + 1) % NA;
            b = (b + 1) % NB;
        }
        cout << ansA << " " << ansB << endl;
    
        return 0;
    }
    
    
  • 0
    @ 2018-06-25 10:32:18

    模拟

    #include <stdio.h>

    int n, na, nb;

    int a[200];
    int b[200];

    int t[5][5] = {
    {0, 0, 1, 1, 0},
    {1, 0, 0, 1, 0},
    {0, 1, 0, 0, 1},
    {0, 0, 1, 0, 1},
    {1, 1, 0, 0, 0}
    };

    int main()
    {
    int i;
    int ascore = 0, bscore = 0;
    scanf("%d%d%d", &n, &na, &nb);
    for (i = 0; i < na; i++)
    scanf("%d", a + i);
    for (i = 0; i < nb; i++)
    scanf("%d", b + i);
    for (i = 0; i < n; i++) {
    ascore += t[a[i%na]][b[i%nb]];
    bscore += t[b[i%nb]][a[i%na]];
    }
    printf("%d %d", ascore, bscore);
    return 0;
    }

  • 0
    @ 2018-03-08 13:14:24

    小心表!!!
    暴力解法!!!!!!!!!!!!!!
    #include<iostream>
    using namespace std;
    int a[34534],b[42353];
    int main()
    {
    int n,m,x,num=0,sum=0;
    cin>>n>>m>>x;
    for (int i=1;i<=m;i++)
    {
    cin>>a[i];

    }
    for (int i=1;i<=x;i++)
    {
    cin>>b[i];

    }
    for (int i=1;i<=n;i++)
    { a[m+i]=a[i];
    b[x+i]=b[i];
    if (a[i]==b[i]) num+=0;
    if (a[i]==b[i]) sum+=0;
    if (a[i]==0&&b[i]==2) num+=1;
    if (a[i]==0&&b[i]==3) num+=1;
    if (a[i]==0&&b[i]==1) sum+=1;
    if (a[i]==0&&b[i]==4) sum+=1;
    if (a[i]==1&&b[i]==3) num+=1;
    if (a[i]==1&&b[i]==2) sum+=1;
    if (a[i]==1&&b[i]==0) num+=1;
    if (a[i]==1&&b[i]==4) sum+=1;
    if (a[i]==2&&b[i]==4) num+=1;
    if (a[i]==2&&b[i]==0) sum+=1;
    if (a[i]==2&&b[i]==1) num+=1;
    if (a[i]==2&&b[i]==3) sum+=1;
    if (a[i]==3&&b[i]==0) sum+=1;
    if (a[i]==3&&b[i]==1) sum+=1;
    if (a[i]==3&&b[i]==2) num+=1;
    if (a[i]==3&&b[i]==4) num+=1;
    if (a[i]==4&&b[i]==0) num+=1;
    if (a[i]==4&&b[i]==1) num+=1;
    if (a[i]==4&&b[i]==2) sum+=1;
    if (a[i]==4&&b[i]==3) sum+=1;
    }
    cout<<num<<" "<<sum;
    return 0;
    }

  • 0
    @ 2017-10-31 09:54:27

    #include<cstdio>
    #include<cstdlib>
    int main()
    {
    int N,NA,NB;
    int i;
    bool f[5][5]=
    {
    {0,0,1,1,0},
    {1,0,0,1,0},
    {0,1,0,0,1},
    {0,0,1,0,1},
    {1,1,0,0,0}
    };
    scanf("%d%d%d",&N,&NA,&NB);
    int az=(int)calloc(NA,sizeof(int));
    int bz=(int)calloc(NB,sizeof(int));
    int score_a=0,score_b=0;
    for(i=0;i<NA;i++)
    scanf("%d",&az[i]);
    for(i=0;i<NB;i++)
    scanf("%d",&bz[i]);
    for(i=0;i<N;i++){
    int a=az[i%NA];
    int b=bz[i%NB];
    score_a+=f[a][b];
    score_b+=f[b][a];
    }
    printf("%d %d",score_a,score_b);
    return 0;
    }

  • 0
    @ 2017-09-11 17:05:17

    int main()
    {
    int n, na, nb, i, j, x, y;
    int A = 0, B = 0;
    int a[201][2] = { 0 };
    scanf_s("%d %d %d", &n, &na, &nb);
    for (i = 1; i <= na; i++){
    scanf_s("%d", &a[i][0]);
    }
    for (i = 1; i <= nb; i++){
    scanf_s("%d", &a[i][1]);
    }
    if (n%na == 0){
    x = n / na;
    }
    else{
    x = n / na + 1;
    }
    if (n%nb == 0){
    y = n / nb;
    }
    else{
    y = n / nb + 1;
    }
    for (j = 0; j < x; j++){
    for (i = 1; i <= na; i++){
    a[j*na + i][0] = a[i][0];
    }
    }
    for (j = 0; j < y; j++){
    for (i = 1; i <= nb; i++){
    a[j*nb + i][1] = a[i][1];
    }
    }
    for (i = 1; i <= n; i++){
    if (a[i][0] == a[i][1]){
    A = A;
    B = B;
    }
    else{
    if (a[i][0] == 0){
    if (a[i][1] == 2 || a[i][1] == 3){
    A++;
    }
    else{
    B++;
    }
    }
    if (a[i][0] == 1){
    if (a[i][1] == 0 || a[i][1] == 3){
    A++;
    }
    else{
    B++;
    }
    }
    if (a[i][0] == 2){
    if (a[i][1] == 1 || a[i][1] == 4){
    A++;
    }
    else{
    B++;
    }
    }
    if (a[i][0] == 3){
    if (a[i][1] == 2 || a[i][1] == 4){
    A++;
    }
    else{
    B++;
    }
    }
    if (a[i][0] == 4){
    if (a[i][1] == 0 || a[i][1] == 1){
    A++;
    }
    else{
    B++;
    }
    }
    }
    }
    printf("%d %d\n", A, B);
    return 0;
    }

  • 0
    @ 2017-06-17 18:43:13

    水题
    #include <iostream>
    #include <cstdio>
    #include <cstring>

    using namespace std;
    const int maxn = 205;
    int a[maxn];
    int b[maxn];
    int aWin[maxn];
    int bWin[maxn];

    int decide(int w,int z){
    bool choice = false;
    if(w > z){
    int temp = z;
    z = w;
    w = temp;
    choice = true;
    }
    if(w == z){
    return 0;
    }
    else if((w == 0 && z == 1) || (w == 1 && z == 2) ||
    (w == 2 && z == 3) || (w == 0 && z == 4) || (w == 1 && z == 4) ){
    if(choice){
    return 1;
    }
    else return -1;
    }
    else if((w == 0 && z == 2) || (w == 0 && z == 3) ||
    (w == 1 && z == 3) || (w == 2 && z == 4) ||(w == 3 && z == 4) ){
    if(choice){
    return -1;
    }
    else return 1;
    }
    }

    int findWin(int n,int g[]){
    int counter = 0;
    for(int i = 1; i < n+1;i++){
    if(g[i] == 1){
    counter ++;
    }
    }
    return counter;
    }

    int main(){
    int na,nb,n;
    cin >> n >> na >> nb;
    for(int i = 1;i < na+1;i++){
    cin >> a[i];
    }
    for(int i = 1;i < nb+1;i++){
    cin >> b[i];
    }
    for(int i = 1;i <= n;i++){
    int p = i % na;
    if(p == 0){
    p = na;
    }
    int q = i % nb;
    if(q == 0){
    q = nb;
    }
    aWin[i] = decide(a[p],b[q]);
    bWin[i] = -aWin[i];
    }
    cout << findWin(n,aWin) << " " << findWin(n,bWin) << endl;
    return 0;
    }

  • 0
    @ 2017-02-12 19:43:18

    include <cstdio>

    using namespace std;
    int main()
    {
    int n=0,na=0,nb=0;
    int a[205]={0},b[205]={0};
    int pointa=0,pointb=0;
    scanf("%d%d%d",&n,&na,&nb);
    //0 表示“剪刀”,1 表示“石头”,2 表示“布”,3 表示“蜥蜴人”, 4 表示 “斯波克”。
    for(int i=0;i<na;i++)
    {
    scanf("%d",&a[i]);
    }
    for(int i=0;i<nb;i++)
    {
    scanf("%d",&b[i]);
    }
    for(int i=0;i<n;i++)
    {
    if(a[i%na]==0&&b[i%nb]==1)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==1&&b[i%nb]==0)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==0&&b[i%nb]==2)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==2&&b[i%nb]==0)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==1&&b[i%nb]==2)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==2&&b[i%nb]==1)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==0&&b[i%nb]==3)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==3&&b[i%nb]==0)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==1&&b[i%nb]==3)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==3&&b[i%nb]==1)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==2&&b[i%nb]==3)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==3&&b[i%nb]==2)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==0&&b[i%nb]==4)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==4&&b[i%nb]==0)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==1&&b[i%nb]==4)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==4&&b[i%nb]==1)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==2&&b[i%nb]==4)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==4&&b[i%nb]==2)
    {
    pointb++;
    continue;
    }
    if(a[i%na]==3&&b[i%nb]==4)
    {
    pointa++;
    continue;
    }
    if(a[i%na]==4&&b[i%nb]==3)
    {
    pointb++;
    continue;
    }
    }
    printf("%d %d",pointa,pointb);
    return 0;
    }

  • 0
    @ 2016-12-15 00:44:40

    //AC
    #include<iostream>
    using namespace std;
    int main()
    {
    int n,na,nb;
    cin>>n>>na>>nb;
    int *temp1=new int[na];
    int *temp2=new int[nb];
    int *sum1=new int[n];
    int *sum2=new int[n];
    for(int i=0;i<na;i++)
    cin>>temp1[i];
    for(int i=0;i<nb;i++)
    cin>>temp2[i];
    for(int i=0;i<n;i++)
    {
    sum1[i]=temp1[i%na];
    sum2[i]=temp2[i%nb];
    }
    /*for(int i=0;i<n;i++)
    cout<<sum1[i];
    cout<<endl;
    for(int i=0;i<n;i++)
    cout<<sum2[i];
    cout<<endl;*/
    int grade1=0,grade2=0;
    for(int i=0;i<n;i++)
    {
    if(sum1[i]==0&&(sum2[i]==2||sum2[i]==3))
    grade1++;
    if(sum1[i]==1&&(sum2[i]==0||sum2[i]==3))
    grade1++;
    if(sum1[i]==2&&(sum2[i]==1||sum2[i]==4))
    grade1++;
    if(sum1[i]==3&&(sum2[i]==2||sum2[i]==4))
    grade1++;
    if(sum1[i]==4&&(sum2[i]==0||sum2[i]==1))
    grade1++;
    }
    for(int i=0;i<n;i++)
    {
    if(sum2[i]==0&&(sum1[i]==2||sum1[i]==3))
    grade2++;
    if(sum2[i]==1&&(sum1[i]==0||sum1[i]==3))
    grade2++;
    if(sum2[i]==2&&(sum1[i]==1||sum1[i]==4))
    grade2++;
    if(sum2[i]==3&&(sum1[i]==2||sum1[i]==4))
    grade2++;
    if(sum2[i]==4&&(sum1[i]==0||sum1[i]==1))
    grade2++;
    }
    cout<<grade1<<" "<<grade2;
    return 0;
    }

  • 0
    @ 2016-11-18 09:55:16

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    using namespace std;

    int vs[6][6] = {{0, 0, 1, 1, 0},
    {1, 0, 0, 1, 0},
    {0, 1, 0, 0, 1},
    {0, 0, 1, 0, 1},
    {1, 1, 0, 0, 0}};
    int a[300], b[300];

    int main()
    {
    int n, na, nb, ans1 = 0, ans2 = 0;
    scanf("%d%d%d", &n, &na, &nb);
    for(int i = 0; i < na; i++)
    scanf("%d", &a[i]);
    for(int i = 0; i < nb; i++)
    scanf("%d", &b[i]);
    for(int i = 0; i < n; i++)
    if(vs[a[i%na]][b[i%nb]]) ans1++;
    else if(vs[b[i%nb]][a[i%na]]) ans2++;
    printf("%d %d", ans1, ans2);
    return 0;
    }

  • 0
    @ 2016-11-17 00:21:09

    #include<stdio.h>
    int a[300],b[300];
    int A=0,B=0;
    void dog(int a1,int b1)
    {
    if(a1==b1)return;
    if(a1==0&&(b1==3||b1==2)||a1==1&&(b1==0||b1==3)||a1==2&&(b1==4||b1==1)||a1==3&&(b1==2||b1==4)||a1==4&&(b1==0||b1==1))
    {
    A++;
    return;
    }
    else B++;
    }
    int main()
    {
    int n,na,nb,i,t;
    scanf("%d %d %d",&n,&na,&nb);
    for(i=1;i<=na;i++)
    {
    scanf("%d",&a[i]);
    }
    a[0]=a[na];
    for(i=1;i<=nb;i++)
    {
    scanf("%d",&b[i]);
    }
    b[0]=b[nb];
    for(i=1;i<=n;i++)
    {
    dog(a[i%na],b[i%nb]);
    }
    printf("%d %d\n",A,B);
    return 0;
    }

  • 0
    @ 2016-11-11 21:12:06
    program jiandaoshitoubu;
    var
      n,i,j,ta,tb,sa,sb,p,q:longint;
      a,b:array [-1..202] of longint;
    function judge(jia,yi:longint):integer;
    begin
       case jia of
         0:
           case yi of
             0:exit(8);
             1:exit(9);
             2:exit(7);
             3:exit(7);
             4:exit(9);
           end;
         1:
           case yi of
             0:exit(7);
             1:exit(8);
             2:exit(9);
             3:exit(7);
             4:exit(9);
           end;
         2:
           case yi of
             0:exit(9);
             1:exit(7);
             2:exit(8);
             3:exit(9);
             4:exit(7);
           end;
         3:
           case yi of
             0:exit(9);
             1:exit(9);
             2:exit(7);
             3:exit(8);
             4:exit(7);
           end;
         4:
           case yi of
             0:exit(7);
             1:exit(7);
             2:exit(9);
             3:exit(9);
             4:exit(8);
           end;
       end;
    end;
    BEGIN
      readln(n,ta,tb);
    
      sa:=0; sb:=0;
    
      for i:=1 to ta do read(a[i]);
    
      readln;
    
      for i:=1 to tb do read(b[i]);
    
      for i:=1 to n do
        begin
          p:=a[i mod ta]; q:=b[i mod tb];
          if i mod ta =0 then p:=a[ta];
          if i mod tb =0 then q:=b[tb];
    
          case judge(p,q) of
            7:inc(sa);
            9:inc(sb);
          end;
        end;
      write(sa,' ',sb);
    END.
    

    水的一b~~~

生活大爆炸版 石头剪刀布

信息

ID
1905
难度
3
分类
模拟 点击显示
标签
递交数
3539
已通过
1711
通过率
48%
被复制
18
上传者