Hdu1847good Luck in CET-4 everybody! Game

Source: Internet
Author: User

Can be found is 3, for any number we can subtract 1 or 2 to get a multiple of 3, and a multiple of three
cannot be taken out at once
In doing the time to find a must defeat, but did not think of a multiple of three, so had to force the enumeration of all the winning and must defeat point
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace Std;
const int MAXN = 1010;
int POS[MAXN];
int main ()
{
memset (POS, 0, sizeof (POS));
POS[1] = 1;
POS[2] = 1;
for (int i = 3;i <=; i++)
{
if (!pos[i])
{
for (int j = 0; (1<<j) <=1000; j + +)
pos[i+ (1<<j)] = 1;
}
}
int n;
while (~SCANF ("%d", &n))
{
if (Pos[n]) printf ("kiki\n");
else printf ("cici\n");
}
return 0;
}



































Hdu1847good Luck in CET-4 everybody! Game

Related Article

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.