Lucky Boy

Problem Description

Recently, Lur have a good luck. He is also the cleverest boy in his school as he create the most popular computer game – Lucky Boy. The game is played by two players, a and b, in 2d planar .In the game Lucky Boy, there are n different points on plane, each time one can remove one or multiple co-line points from the plane. The one who can firstly remove more than two points from the plane wins. The one who removes the last point on the plane can also win the game. You may assume that two players are both clever enough that they can always make the best choice. The winner is called Lucky Boy.
Given the n
points, can you tell me who will be the Lucky Boy ? Note that player a will
always the first one to remove points from the plane.

Input

The first line of each case is an integer n(0<n<=103),
following n lines each contains two integers x and y(0<=x, y<=108),
describing the coordinates of each point. Ended by EOF.

Output

Output “a is the lucky boy.” in a single line if a win the
game, otherwise you should output “b is the lucky boy.” in a single line.

Sample Input

3
0 0
1 1
2 2
3
0 0
1 1
2 3

Sample Output

a is the lucky boy.
b is the lucky boy.

描述:

题目大意,就是说呢,有两个孩子一起玩游戏,分别是 A 和 B一起玩。 这个游戏呢,很简单就是说,现在有 n 个石头吧,然后每次可以拿一条直线上面的所有石头,要么一次拿3个及以上的人可以赢,要么就是最后一次拿石头的人可以赢。然后A先拿。 所以呢,对于第一种赢的方式,只要有3个石头同一条线,A是肯定会赢的,如果没有三个石头同一条线的话,这就是一个博弈了。如果剩下1个石头或者两个石头,那么那个人是比赢的,因此想要自己赢,就得让对手拿的时候是3块石头可以了。所以对于A而言,如果现在是3块石头,那么自己就会输,因为每次A,B都是选最优的,只要A拿的时候是3的倍数,那么A就会输。比如说现在有6个石头,A可以拿1个或者两个,那么B像赢,只要让剩下的是3个就可以了,那么A拿一个,B就拿两个, A拿两个,B就拿1个,对于9个石头,无论A拿一个还是两个,B只要让剩下的是6个就好了。所以,如果石头是3的倍数,A必输。因此先判断有没有3个石头是在一条线上的,再判断是不是3的倍数。具体的判断,初等数学知识。

 #include<cstdio>
struct Point
{
int x;
int y;
}p[];
int main()
{
int n,x,y;
while (scanf("%d", &n) != EOF)
{
for (int i = ; i <= n;i++) scanf("%d%d", &p[i].x, &p[i].y);
bool win = false;
if (n % )win = true;
else
{
for (int i = ; i <= n&&!win; i++)
for (int j = i+; j <= n&&!win; j++)
for (int k = j+; k <= n&&!win; k++)
if ((p[i].x - p[j].x)*(p[i].y - p[k].y) == (p[i].x - p[k].x)*(p[i].y - p[j].y))
win = true;
}
if (win)printf("a is the lucky boy.\n");
else printf("b is the lucky boy.\n");
}
return ;
}

Lucky Boy的更多相关文章

  1. lucky 的 时光助理(2)

    lucky小姐说:昨天晚上他喝醉了,发消息说他想我了,说他后悔了. 我很惊讶. 我问lucky:你们很久都没有联系, 突然说... 你怎么想. 没错,'他'就是lucky的前男友. lucky看着我, ...

  2. lucky 的 时光助理

    2017年的lucky小姐,厌倦了现在的工作,她觉得这些的工作对于她而言不具备挑战性,她在迷茫春节过后该如何选择, 这里是距她走出校门整整一年的时光. lucky小姐从开发走向了实施,目的是想周游这个 ...

  3. ZOJ3944 People Counting ZOJ3939 The Lucky Week (模拟)

    ZOJ3944 People Counting ZOJ3939 The Lucky Week 1.PeopleConting 题意:照片上有很多个人,用矩阵里的字符表示.一个人如下: .O. /|\ ...

  4. Lucky and Good Months by Gregorian Calendar - POJ3393模拟

    Lucky and Good Months by Gregorian Calendar Time Limit: 1000MS Memory Limit: 65536K Description Have ...

  5. hdu 5676 ztr loves lucky numbers

    题目链接:hdu 5676 一开始看题还以为和数位dp相关的,后来才发现是搜索题,我手算了下,所有的super lucky number(也就是只含数字4, 7且4, 7的数量相等的数)加起来也不过几 ...

  6. Lucky 2048 - The secret of being lucky

    Lucky 2048 uses a normal distribution to create "lucky" start. Generally speaking, it prov ...

  7. 枚举 + 进制转换 --- hdu 4937 Lucky Number

    Lucky Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)To ...

  8. [py]简易pick lucky num程序

    程序功能: 1,用户输入数字,当用户输入指定数字时候,输出他输入的循环那次 2,第二次询问是否还要输 3,如果no 则 终止 4,如果yes则继续输入 判断输入是否大于首次输入的 如果大于则开始循环输 ...

  9. HDU 5213 Lucky 莫队+容斥

    Lucky Problem Description WLD is always very lucky.His secret is a lucky number K.k is a fixed odd n ...

  10. Gym 100637F F. The Pool for Lucky Ones

    F. The Pool for Lucky Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

随机推荐

  1. 基础习题1——print

    引号内,空格就表示空格,引号外,逗号表示空格 print('100+200 =',100 + 200)===100+200 = 300 print('hello','world')===hello w ...

  2. CDOJ 1073 线段树 单点更新+区间查询 水题

    H - 秋实大哥与线段树 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%lld & %llu Submit S ...

  3. 2019 Multi-University Training Contest 3 T7 Find the answer

    Find the answer Time Limit: 4000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tota ...

  4. Oracle--表有LONG类型复制或导数报ORA00990

    SYS@racdb1> create table siebel.S_ORG_EXT_201707101650 as select * from siebel.S_ORG_EXT where 1= ...

  5. druid监控每个服务数据库连接数和SQL执行效率

    1.下载druid 2.将刚刚下载的druid放入tomcat下的lib目录 3.配置要监控的服务启动文件,添加: -Dcom.sun.management.jmxremote.port=4090 - ...

  6. esLint——规范你的代码(转)

    团队协作时,若是团队的代码风格统一,能够大大减少沟通成本. 什么是 ESLint ? ESLint 是在 ECMAScript/JavaScript 代码中识别和报告模式匹配的工具,它的目标是保证代码 ...

  7. 关于项目中的一些经验:封装activity、service的基类,封装数据对象

    经验一,将几个页面公用的数据,和方法进行封装,形成一个baseActivity的类: package com.ctbri.weather.control; import java.util.Array ...

  8. sock( ) bind( ) connect( )

    Linux下的socket()函数 调用头文件<sys/socket.h>中的socket函数 int socket(int af, int type, int protocol); 1) ...

  9. Delphi XE2 之 FireMonkey 入门(45Finally) - 结题与问题

    Delphi XE2 之 FireMonkey 入门(45Finally) - 结题与问题 很喜欢 FMX 的一些新控件, 如: TExpander.TArcDial.TComboTrackBar.T ...

  10. spring中的增强类型

    在spring中有两种增强方式:XML配置文件和注解配置.下面一次为大家讲解. 使用的是Aspectj第三方框架 纯POJO (在XML中配置节点) 使用@AspectJ,首先要保证所用的JDK 是5 ...