Niuke.com Chess (Game && Strange Situation)

topic link

 

analyze: 

no analysis...

Draw a form, fill it out, and you will find that it is the same as the first few items in the strange situation

Then make a table of strange situations and you will be able to AC

 

#include<bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb(i) push_back(i)
#define pii pair<int, int>
#define pll pair<long long, long long>
#define MK(i, j) make_pair(i, j)
#define mem(a, b) memset(a, b, sizeof(a))
#define ins(i) insert(i)
#define lowbit(i) (i & (-i))
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define INF (0x3f3f3f3f)
using namespace std;
const int maxn = 1e4 + 10;
int arr[maxn];

inline void init()
{
    mem(arr, -1);
    int num = 0;
    for(int i=0; i+num<maxn; i++){
        if(arr[i] == -1){
            arr[i] = i+num;
            arr[i+num] = i;
            num ++ ;
        }
    }
}

int main(void)
{
    init();
    int a, b;
    while(~scanf("%d %d", &a, &b)){
        if(arr[a] == b || arr[b] == a) puts("Lao Wang");
        else puts("Xiao Ren");
    }
    return 0;
}
View Code

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325123476&siteId=291194637