good Luck in CET-4 everybody!
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 3311 Accepted Submission (s): 2066
Problem Description College English level Four exam is coming, you are not in a tense review. Perhaps the tension even short semester of ACM have no time to practice, anyway I know Kiki and CiCi are so. Of course, as in the examination room infiltration of more than 10 of contemporary college students, Kiki and CiCi know more about the relaxation before the test, the so-called "relaxation Youdao" is the meaning. No, Kiki and CiCi play poker for a while to relax their nerves before they rest every night.
"Upgrade". "Double buckle". "Red Five". or a "landlord".
Of course not. That's so vulgar ~
As a student of computer college, Kiki and CiCi did not forget the profession when they played cards, the rules of their playing cards were like this:
1, a total of n cards;
2, the two sides take turns to seize the card;
3, the number of each grab card can only be 2 power (ie: 1,2,4,8,16 ... )
4, grasp the card, the outcome of the results also came out: the end of the hand to catch the winner;
Suppose Kiki and CiCi are smart enough (in fact, not to assume that there are not smart students ~), and each time is Kiki first grab, ask who can win it.
Of course, playing cards no matter who wins is not a problem, it is important that the immediate arrival of the CET-4 can have a good state.
Good luck in CET-4 everybody!
Input data contains multiple test cases, one row for each test case, and an integer n (1<=n<=1000).
Output if Kiki can win, please export "Kiki", otherwise please output "Cici", the output of each instance is one row.
Sample Input
1 3
Sample Output
Kiki Cici
/* Idea: Use SG function
in detail: http://baike.baidu.com/view/2855458.htm */
#include <iostream>
using namespace std;
int s[10] = {1,2,4,8,16,32,64,128,256,512}, vi[1002];
void Get_sg ()
{
memset (vi,false, sizeof (vi));
for (int i = 1; I <=, i + +)
{for
(int j = 0; J < J + +)
if (i >= s[j] &&!vi[i-s [j]]) {
Vi[i] = true;
Break
;
}}} int main (void)
{
int n;
Get_sg ();
while (CIN >> N)
{
if (Vi[n])
cout<< "Kiki" <<endl;
else
cout<< "Cici" <<endl;
}
return 0;
}
/* Idea:
This is also a BA Shi game
, if you are the initiator, consider your winning state. Note that because any positive integer can be written as a sum of several 2 of the whole number of powers. As the rule can only take one of 2 of the power of the whole number, as long as you leave your opponent with a multiple of 3 cards, then you will win, because left a multiple of 3, the opponent has two cases:
1: If the other hand to grasp the card only 3 cards, the other side either take 1, or take 2, the rest of you take away, win.
2: If the other side of the hand when the card is left 3*k card, the opponent regardless of how much, the remaining number of cards is 3*x+1 or 3*x+2.
when it's your turn, you can construct a multiple of 3. So in either case, when you leave your opponent for 3*k, you win. The
title says Kiki first grab the card, then when the number of cards is a multiple of 3, Kiki loses. Otherwise Kiki can use the initiator advantage will leave each other's card number into a multiple of 3, will win.
*/
#include <iostream>
using namespace std;
int main (void)
{
int n;
while (CIN >> N)
{
if (n%3)
cout<< "Kiki" <<endl;
else
cout<< "Cici" <<endl;
}
return 0;
}