标签:acm 测试 others 问题 ever vector strong 测试用例 size
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9519 Accepted Submission(s): 6158
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <queue> #include <map> #include <cmath> #include <vector> using namespace std; typedef long long LL; const int N = 1010; int sg[N], vis[N]; int s[N];//每次可以走的步数 void get_sg() { int i, j; for(i = 0; i < N; i++) { memset(vis, 0, sizeof(vis)); for(j = 0; s[j] <= i; j++) vis[sg[i - s[j]]] = 1; for(j = 0; j < N; j++) if(!vis[j]) { sg[i] = j; break; } } } int main() { int n, i; for(i = 0; i <= 10; i++) s[i] = 1 << i; get_sg(); while(~scanf("%d", &n)) { if(sg[n]) printf("Kiki\n"); else printf("Cici\n"); } return 0; }
HDU 1847 Good Luck in CET-4 Everybody! (sg函数)
标签:acm 测试 others 问题 ever vector strong 测试用例 size
原文地址:http://www.cnblogs.com/yu0111/p/6686268.html