题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1714 nim游戏的一个变形,需要打出sg函数的表 #include <bits/stdc++.h> using namespace std; typedef long long LL; ; ], maxs; int vis[maxn]; //yu控制递归层数,cur控制所分配最大值,next控制所分配最小值 void dfs(int cur, int yu…
Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 613 Accepted Submission(s): 282 Problem Description Nim is a two-player mathematic game of strategy in which players take turns…
打出SG表来可以很容易的发现i为偶数时 SG[i]=i/2 i为奇数时 SG[i]=SG[i/2] #include<bits/stdc++.h> typedef long long ll; using namespace std; ll SG(ll x) { ?SG(x/):x/; } int main() { int t; scanf("%d", &t); while (t--) { int n; ll a, v = ; scanf("%d"…
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1714 nim游戏的一个变形,需要打出sg函数的表 #include <bits/stdc++.h> using namespace std; typedef long long LL; ; ], maxs; int vis[maxn]; //yu控制递归层数,cur控制所分配最大值,next控制所分配最小值 void dfs(int cur, int yu…