zcmu 1466 lucky boy

1466: Lucky Boy

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 40  Solved: 17
[Submit][Status][Web Board]

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或2个石头,最后一拿必赢,因此想要自己赢,就得让对手拿的时候是3块石头。于是石头数是3的倍数时为奇异局势。如有6个石头,A可以拿1或2个,那么B只要让剩下的是3个就能赢。于是,如果石头是3的倍数,A必输。

#include<bits/stdc++.h>
#define ll long long
#define ve vector
#define mp map
#define NO cout<<"NO"<<endl;
#define YES cout<<"YES"<<endl;
#define pre(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,b,a) for(int i=b;i>=a;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define st string
#define N 10005
#define eps 1e-13
using namespace std;
const double pi =acos(-1.0);
const int maxn=1e6+5;
const ll mod =1e15;
const int dx[]={-1,0,1,0};
const int dy[]={0,1,0,-1};
//set<ll> s;
ve<ll> v;
priority_queue<ll, ve<ll>, greater<ll> >q;
int lcm(int a,int b){
    return a*b/__gcd(a,b);
}
bool isleaf(int x){
     return x%400==0||(x%4==0&&x%100==0);
}
int primes[N], cnt;
bool vis[N];
void is_prime(int x){
    vis[1] = vis[0] = 1;
    for(int i = 2; i <= x; ++ i){
        if(!vis[i])primes[cnt ++ ] = i;
        for(int j = 0; primes[j] * i <= x; ++ j){
            vis[primes[j] * i] = true;
            if(i % primes[j] == 0)break;
        }
    }
}//1e6;
ll qpow(ll a,ll n)//快速幂 ll mod=1e15;
{
    ll re=1;
    while(n)
    {
        if(n&1)
            re=(re*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return re;
}
inline ll qmul(ll x,ll y,ll p)//快速乘 
{
    ll z=(long double)x/p*y;
    ll res=(unsigned long long)x*y-(unsigned long long)z*p;
    return (res+p)%p;
}
void pprint(char *);
struct ob
{
	char MC[100];
	double DJ;
	int SL;
};

int sum[maxn];
void iprime(){
	mem(sum,1);
	pre(i,2,maxn/2)
 	   for(int j=i*2;j<maxn;j+=i)
 	   	   sum[j]+=i;
}

bool isprime(int m){
	for(int i=2;i<=pow(m,0.5);i++){
		if(m%i==0) return false;
	}
	return true;
}

struct object{
    int x;
    int y;
}dp[1010];
int main(){
    int n,x,y;
    while(cin>>n){
        pre(i,1,n)cin>>dp[i].x>>dp[i].y;//石子的方位 
        bool flag=false;
        if(n%3)flag=true;//不是3的倍数,A赢 
        else{
            for(int i=1;i<=n&&!flag;i++)
                for(int j=i+1;j<=n&&!flag;j++)
                    for(int k=j+1;k<=n&&!flag;k++)
                        if((dp[i].x-dp[j].x)*(dp[i].y-dp[k].y)==(dp[i].x-dp[k].x)*(dp[i].y-dp[j].y))
                            flag=true;//石子连成一条线时取,A赢,没有则B赢 
        }
        if(flag)cout<<"a is the lucky boy."<<endl;
        else    cout<<"b is the lucky boy."<<endl;
    }
    return 0;
}

### 回答1: zcmu 1093 简单计算器是一道编程题目,要求实现一个简单的计算器,能够进行加、减、乘、除四种基本运算。该题目主要考察编程基础能力和算法思维能力,需要熟练掌握基本的运算符和控制语句,能够设计合理的算法实现计算器功能。 ### 回答2: zcmu 1093 简单计算器是一种基于计算机技术的工具,用于进行基本算术运算,如加减乘除等。它能够简化我们在日常生活中的计算工作,提高计算效率,减少出错率。 使用zcmu 1093 简单计算器非常简单,只需输入需要计算的数字和符号,就能够得到计算结果。它可以进行多个数字之间的复杂运算,同时还支持小数、百分数、平方根等复杂运算。另外,zcmu 1093 简单计算器还可以存储中间计算结果,方便我们进行多步计算或调整计算过程。 除了日常的计算工作,zcmu 1093 简单计算器还可用于科学计算、工程设计等领域。许多专业软件都是基于简单计算器原理设计的,它们具有更高的计算精度和更复杂的运算能力,能够支持更高级别的科学计算和技术分析。 总之,zcmu 1093 简单计算器在日常生活中有着广泛的应用,它使我们的计算工作变得更加高效、准确。并且,随着科技的不断发展,这种计算工具也在不断地更新和改进,为我们的计算工作提供更加便捷、多样化的选择。 ### 回答3: ZCMU 1093 简单计算器是一道基础的算法题目,需要实现一个简单的计算器程序,支持加、减、乘、除四种基本运算,可以对两个整数进行运算并输出结果。 要实现这道题目,首先需要根据输入的运算符来判断应该进行的运算类型,并根据运算符的不同,执行不同的计算操作。同时,应注意除数不能为零的情况,避免程序出现异常。 在编写程序的过程中,可以使用 switch case 语句来判断不同的运算类型,并执行相应的计算操作。同时,为了能有效地判断输入的运算符,可以使用输入字符串的方式进行处理,提取出运算符进行比较。 此外,在程序中还需要进行合法性判断,确保输入的数字均为整数且在合理的范围内,以避免程序运行出现异常情况。同时,还需要考虑输入格式的问题,应确保输入的数字和运算符符合题目要求。 综上所述,ZCMU 1093 简单计算器是一道基础的算法题目,需要实现一个简单的计算器程序,支持加、减、乘、除四种基本运算,注意程序的合法性判断和输入格式的处理,能够熟练地运用 switch case 等语句完成程序的编写。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值