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. Sublime text3配置C/C++编译环境

    安装sublime text3后,一直很喜欢使用它看代码(这个高亮配色真的很好看).它默认的运行环境就有C/C++,在写了一个hello world!后正常输出,但在加入scanf()输入后就不行了. ...

  2. js-头部的下拉框出现与隐藏,注意加上stop??

    效果: 主要代码:

  3. 学习经常遇到的浮动(float)

    参考自 小辉随笔: https://www.cnblogs.com/lchsirblog/p/9582989.html 一.什么时候需要使用浮动 最常见的情景是:多个块级元素(如div)需要同一行显示 ...

  4. 15. ClustrixDB 管理数据分布

    本节使用的关键术语: Relation — ClustrixDB中的每个表都被称为“关系”. Representation — 在ClustrixDB中,每个索引都称为一个“Representatio ...

  5. JAVA批量文件下载

    1,看看我们封装的方法 方法中有三个参数:视频url,文件夹路径,视频名称. 调用方法进行下载. 2,看看结果 打印结果 文件夹下的视频下载成功 详细的参数配置可以参考我写的这篇文章:http://b ...

  6. nmon性能监控

    1.nmon下载地址 2../nmon_x86_rhel52 3.根据上面提示的快捷键进行输入即可显示相应的资源耗用情况,如输入:c.m.d(显示cpu.内存.磁盘使用情况) 4.输入数据到文件 ./ ...

  7. 20175308 实验三《敏捷开发与XP实践》

    20175308 实验三<敏捷开发与XP实践> 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim编辑器> 课程 完成实验.撰写实验 ...

  8. ES排序值相同顺序随机的问题

    ES排序值相同顺序随机的问题 code[class*="language-"] { padding: .1em; border-radius: .3em; white-space: ...

  9. Base table or view not found

    项目 代码分细致 改为Logic, Model, Controller ,View  四个模块 $model=D("Index",'Logic'); $res=$model-> ...

  10. leetcode-mid-array-sorting and searching - 215 Kth Largest Element in an Array

    mycode  77.39% class Solution(object): def findKthLargest(self, nums, k): """ :type n ...