博弈例题

23 篇文章 0 订阅
8 篇文章 0 订阅
这篇博客探讨了博弈论中的几种经典问题,如巴什博弈、尼姆博弈和威佐夫博弈,以及如何解决这些问题。作者提供了AC代码示例,解释了如何判断游戏是否公平。此外,还涉及了一个简单的超简单问题,主要考察输入处理和比较操作。
摘要由CSDN通过智能技术生成

巴什博弈

尼姆博弈

威佐夫博弈

公平组合博弈

eg.1 hdu2147
AC代码:

#include <bits/stdc++.h>
using namespace std;

int n, m;

int main(){
	while(cin >> n >> m){
		if(n == 0 && m == 0) break;
		if(n % 2 == 0 || m % 2 == 0) cout << "Wonderful!" << endl;
		else cout << "What a pity!" << endl;
	}
	return 0;
}

eg.2
https://vjudge.net/contest/429544#problem/D
超简单,读懂题就会写(不属于上面的任何一种博弈)

#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 4;

int t;
int n, m;
int a[N], b[N];

int main(){
	cin >> t;
	while(t--){
		cin >> n >> m;
		for (int i = 1; i <= n; ++i) cin >> a[i];
		for (int j = 1; j <= m; ++j) cin >> b[j];
		if(n <= m) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	return 0;
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值