codeforces 777 A

三个盖子 

其中里面有一个下面有求

一个人移来移去

奇数次 0 1 换 偶数次 1 2 换

给你最后的位子移动的次数 问开始的位子 

显然这个题有循环结      6  

然后暴力一下  

#include <iostream>
#include<string.h>
#include<stdio.h>
using namespace std ;
#define LL long long

int z[3];

int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    n=n%6;
    int ok=0;

    for(int k=0;k<=2;k++)
    {
        memset(z,0,sizeof(z));
        z[k]=1;
        for(int i=1;i<=n;i++)
        {
            if(i%2==1)
                swap(z[0],z[1]);
            else
                swap(z[1],z[2]);
        }
        if(z[x]==1)
            ok=k;
    }
    printf("%d
",ok);
    return 0 ;
}
原文地址:https://www.cnblogs.com/cherryMJY/p/6480718.html