UESTC - 930 Lucky Boy (精度)

Lucky Boy

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)
 

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 a and  b b, in  2 2d planar .In the game Lucky Boy, there are  n 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<n103) n(0<n≤103), following  n n lines each contains two integers  x x and  y(0x,y108) y(0≤x,y≤108), describing the coordinates of each point. Ended byEOF.

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 Sample Output
3
0 0
1 1
2 2
3
0 0
1 1
2 3
a is the lucky boy.
b is the lucky

Sample input and output




#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define ll long long
#define ld long double

double a[1003][2];
int n;
int main()
{
    while(scanf("%d",&n) != EOF)
    {
        int sum = 0;
        for(int i = 0; i < n; i++)
        {
            scanf("%lf%lf",&a[i][0],&a[i][1]);
        }
        int flag = 0;
        for(int i = 0; i < n; i++)
        {
            for(int j = i+1; j < n; j++)
            {
                double a1 = a[j][1]-a[i][1],a2;
                double b1 = a[i][0]-a[j][0],b2;
                double c1 = a[j][0]*a[i][1] - a[j][1]*a[i][0],c2;
                for(int k = j+1; k < n; k++)
                {
                    a2 = a[k][1]-a[i][1];
                    b2 = a[i][0]-a[k][0];
                    c2 = a[k][0]*a[i][1] - a[k][1]*a[i][0];
                    if((a1*b2 == a2*b1) && a1*c2 == a2*c1)
                    {
                        flag = 1;
                        break;
                    }
                }
                if(flag)break;
            }
            if(flag)break;
        }
        if(flag || n%3 || n <= 2)printf("a is the lucky boy.\n");
        else printf("b is the lucky boy.\n");
    }
    return 0;
}

     
     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值