Hdoj HDU 1847 good luck in CET-4 everybody! ACM 1847 in HDU

Source: Internet
Author: User
Miyu original, post Please note: Reprinted from __________ White House

Question address:
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1847
Description: Problem description
The CET-4 is coming soon. Are you busy reviewing? Maybe even the short term ACM has no time to practice. I know Kiki and Cici. Of course, Kiki and Cici, as contemporary college students infiltrated more than a dozen years in the test room, better understand the relaxation before the test. The so-called "Zhang Chi youdao" means this. No, Kiki and Cici have to play cards for a while before taking a rest every night to relax their nerves.
"Upgrade "? "Double buckle "? "Red Five "? Or "Landlords "?
Of course not! That's cool. ~
As a computer school student, Kiki and Cici did not forget their major when playing cards. The rules for playing cards are as follows:
1 , A total of N cards;
2 The two sides take turns to capture cards;
3 The number of cards each time can only be 2 power times (I .e: 1 , 2 , 4 , 8 , 16 ...)
4 After the cards are captured, the winning and losing results also come out: the people who finally caught the cards are the winners;
Suppose Kiki and Cici are both smart enough (in fact, you don't have to assume that there are unintelligent students ~ ), And Kiki is the first player each time. Who can win?
Of course, no matter who wins the cards, it's not a problem. What's important is the coming CET. - 4. Good status.

Good luckInCet-4Everybody!
 

Input
The input data contains multiple test cases. Each test case occupies one row and contains an integer N (1<=N<=1000).
 

Output
If Kiki can win, output "Kiki"; otherwise, output "Cici", which occupies one line for each instance.
 

Sample Input
1
3
 

Sample output
Kiki
Cici

Question Analysis:Miyu original, post Please note: Reprinted from__________ White House

First of all, we can think of a defeat in the face of 3. Whoever faces 3 will lose no matter how much! <--- This is the key
Then try to cause such a situation to the other party, because any number plus 1 or 2 that is not a multiple of 3 can become a multiple of 3,
Similarly, subtraction of 1 or 2 can also be a multiple of 3. That is to say, if the current number is not a multiple of 3, then I can certainly take it.
Take it as a multiple of 3. For example, if it is 11 now, I will take 2 and change it to 9, which leads to the situation where the opposite party is a multiple of 3.
If the other party takes m, I can take 1 or 2 to make the total number of rounds into a multiple of 3, so there are two situations:
1. Just finished.
2. The remaining three are multiples. Continue;
So it will win

CodeAs follows:Miyu original, post Please note: Reprinted from__________ White House

# Include < Iostream >
Using   Namespace STD;
Int Main ()
{
Int N;
While (CIN > N)
{
Puts (n %   3   ! =   0   ?   " Kiki " : " Cici " );
}
Return   0 ;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.