Skip to main content
  1. Tags/

Sg函数

2016

hdu 2873 Bomb Game(Sg函数)

·2 mins
hdu 2873题目链接 题意:n*m个格子,有若干炸弹。对于在第一行或者第一列的炸弹,爆炸后会到那一行或者那一列的更前面(总的来说就是更靠近左上角)的位置。对于其他位置的炸弹,爆炸后会生成两个炸弹,分别到那一行的更前面或者那 一列的更前面。问先手是否有必赢策略。

hdu 2509 Be the Winner (anti-sg,sg函数,sj定理)

hdu2509题目链接 题意:??? 思路:同1907 1/* *********************************************** 2Author :111qqz 3Created Time :2016年07月23日 星期六 04时41分38秒 4File Name :code/hdu/2509.cpp 5************************************************ */ 6 7#include <cstdio> 8#include <cstring> 9#include <iostream> 10#include <algorithm> 11#include <vector> 12#include <queue> 13#include <set> 14#include <map> 15#include <string> 16#include <cmath> 17#include <cstdlib> 18#include <ctime> 19#define fst first 20#define sec second 21#define lson l,m,rt<<1 22#define rson m+1,r,rt<<1|1 23#define ms(a,x) memset(a,x,sizeof(a)) 24typedef long long LL; 25#define pi pair < int ,int > 26#define MP make_pair 27 28using namespace std; 29const double eps = 1E-8; 30const int dx4[4]={1,0,0,-1}; 31const int dy4[4]={0,-1,1,0}; 32const int inf = 0x3f3f3f3f; 33int n; 34int main() 35{ 36 #ifndef ONLINE_JUDGE 37 freopen("code/in.txt","r",stdin); 38 #endif 39 40 41 while (~scanf("%d",&n)) 42 { 43 int sum = 0; 44 int cnt = 0 ; 45 for ( int i = 1 ; i <= n ; i++) 46 { 47 int x; 48 scanf("%d",&x); 49 sum^=x; 50 if (x>1) cnt++; 51 } 52 if ((sum==0&&cnt==0)||(sum>0&&cnt>0)) 53 { 54 puts("Yes"); 55 } 56 else 57 { 58 puts("No"); 59 } 60 } 61 62 #ifndef ONLINE_JUDGE 63 fclose(stdin); 64 #endif 65 return 0; 66}

hdu 1730 Northcott Game (二维sg函数)

·2 mins
hdu 1730 题意:n行格子,每行m个,每行有一黑一白两个棋子,给定初始位置,先手执黑棋,后手执白棋,每次可以在同一行内向左移动,不能超过边界,且不能越过对方的棋子,同一个格子只能有一个棋子。问先手是否必赢。

2015