题解 SP1028 【HUBULLU - Hubulullu】

博弈论,可以证明,先手总是赢

一开始我不会,看了cf上国际友人的证明才明白(他用的是反证法):

Proof by contradiction :
Say the initial state is always a losing state. This means regardless of the number the first player picks , the second player ends up with a winning state (if not , the initial state would have been a winning state). Say the first player picks 1 and the second player ends up with {2,3,4,…,N} which is a winning state. Say the second player picks X now and provides the first player with state S (a losing state) , the first player could have just picked X and forced the second player to state S ( a losing state) which is a contradiction. Hence the first player always wins.

代码很容易:

#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		int a,b;
		cin>>a>>b;
		if(b==0)
		{
			puts("Airborne wins.");
		}
		else
		{
			puts("Pagfloyd wins.");
		}
	}
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值