hdu 1536 SG函式的應用

2021-06-17 00:09:34 字數 489 閱讀 2028

hdu 1536

submit time

judge status

pro.id

exe.time

exe.memory

code len.

language

2013-07-24 10:17:33

accepted

1536

109ms

476k

1174 b

c++#include#includeusing namespace std;

//注意 s陣列要按從小到大排序 sg函式要初始化為-1 對於每個集合只需初始化1遍

//n是集合s的大小 s[i]是定義的特殊取法規則的陣列

int s[110],sg[10010],n;

int mex(int x)// 類似於記憶化搜尋

; //vis陣列的定義一定要在函式裡

for (i=0;i

sg函式 參考博文:

HDU 1536 SG函式應用

只要構造好sg函式 就行 ac includeusing namespace std include int a 110 k k為全域性變數 int sg 10010 flag 110 void sg sg函式 int main if s cout w else cout l cout return...

HDU 1536 SG函式模板

題目 多堆石子,先手勝為l,後手勝為w,思路 sg函式 sg i 0表示先手必敗,否則必勝 有多堆石子,每次對sg k 的值亦或 最終為0則必敗,否則必勝 include include include include include include include include include ...

hdu 1536 博弈SG函式

1 include 2 include 3 include 4 include 5 include 6 include 7 include 8 include 9 10using namespace std 1112 const int max 109 13 int num max sg max 1...