hdu 1847

博弈问题,本来以为得好好找规律,仔细一看,n才1000,直接暴力过了~

/*
* hdu1847/win.cpp
* Created on: 2011-10-27
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <functional>
#include <numeric>
#include <cctype>
using namespace std;
const int MAXN = 1010;
bool ans[MAXN];
void init() {
memset(ans, false, sizeof(ans));
for (int i = 1; i < MAXN; i *= 2) {
ans[i] = true;
}
for (int i = 2; i < MAXN; i++) {
int j = 1;
while (j < i) {
if (!ans[i - j]) {
ans[i] = true;
}
j *= 2;
}
}
}

int main() {
#ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
#endif
init();
int n;
while (scanf("%d", &n) == 1) {
printf("%s\n", ans[n] ? "Kiki" : "Cici");
}
return 0;
}



你可能感兴趣的:(HDU)