[hdu 1536 S-Nim] SG 函数
来源:互联网 发布:实体店结算软件 编辑:程序博客网 时间:2024/06/05 02:17
[hdu 1536 S-Nim] SG 函数
题目链接:[hdu 1536 S-Nim]
题意描述:给定
解题思路:裸的SG函数的题目。由
#include <set>#include <queue>#include <cmath>#include <cstdio>#include <string>#include <cstring>#include <iostream>#include <algorithm>using namespace std;//#pragma comment(linker, "/STACK:1024000000,1024000000")#define FIN freopen("input.txt","r",stdin)#define FOUT freopen("output.txt","w",stdout)#define fst first#define snd second#define rep(i, s, t) for(int i = (s); i <= (t); i++)//typedef __int64 LL;//typedef long long LL;typedef pair<int, int> PII;const int MAXN = 100 + 5;const int MX = 10000 + 5;int K, M, L;int s[MAXN], h[MAXN];int sg[MX];bool Hash[MX];void getSG(int SZ) { memset(sg, 0, sizeof(sg)); rep(i, 1, SZ) { memset(Hash, false, sizeof(Hash)); rep(j, 1, K) { if(i - s[j] < 0) break; Hash[sg[i - s[j]]] = true; } rep(j, 0, SZ) { if(Hash[j] == false) { sg[i] = j; break; } } }}int main() {#ifndef ONLINE_JUDGE FIN;#endif // ONLINE_JUDGE int xsum; while(~scanf("%d", &K) && K) { rep(i, 1, K) { scanf("%d", &s[i]); } sort(s + 1, s + K + 1); K = unique(s + 1, s + K + 1) - (s + 1); getSG(MX); scanf("%d", &M); rep(i, 1, M) { scanf("%d", &L); xsum = 0; rep(j, 1, L) { scanf("%d", &h[j]); xsum ^= sg[h[j]]; } putchar(xsum ? 'W' : 'L'); } putchar('\n'); } return 0;}
1 0
- HDU 1536 S-Nim SG函数 Nim
- SG函数 hdu 1536 S-Nim
- hdu 1536 S-Nim sg函数
- HDU 1536 S-Nim 求SG函数
- hdu 1536 S-Nim (sg函数模版)
- S-Nim - HDU 1536 SG函数
- HDU 1536 S-Nim(sg函数)
- HDU 1536 S-Nim (SG函数)
- HDU 1536 S-Nim [SG函数]【博弈】
- [hdu 1536 S-Nim] SG 函数
- HDU 1536 S-Nim(sg函数)
- HDU 1536 S-Nim 博弈,SG函数
- HDU 1536 S-Nim SG函数
- HDU 1536 S-Nim (SG函数)
- hdu 1536 S-Nim(SG函数)
- hdu 1536 S-Nim(SG函数)
- HDU 1536 S-Nim (博弈 sg函数 Nim和)
- hdu 1536、hdu 1944 S-Nim(博弈SG函数)
- Java类的初始化问题
- 如何选择开源许可证
- CyanogenMod - All the source code for CyanogenMod
- MFC学习笔记之对话框调用
- struts2设置Action的数据方式
- [hdu 1536 S-Nim] SG 函数
- spring mvc 异常(runtime异常、ajax异常)统一处理与范例
- poj 1637 Sightseeing tour 混合欧拉图判定
- BP算法数学原理
- Laravel之Blade模板引擎
- hdu1071The area+数学积分
- Maven tomcat7-maven-plugin 部署Maven Web 项目
- 动态规划之编辑距离(Edit Distance)
- CDN加速原理(转载)