http://acm.nyist.net/JudgeOnline/problem.php?pid=401&&简单的博弈论

关于 MCU 芯片外围电路的快速入门介绍 MCU 外围电路的核心是“围绕 MCU 需求,搭建稳定、匹配的外部支撑”,入门阶段无需掌握复杂设计,只需先吃透供电、复位、时钟、IO 驱动、基础通信这五大模块,再逐步扩展存储、显示、传感器等进阶功能。实践中多调试、多参考成熟方案,是快速掌握外围电路设计的关键。码字不易,若觉得本文对你有用,欢迎,相关技术热点时时看🔥🔥🔥​​​… 阅读详情
After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.



The game goes like this:
Two players start the game with a circle of n coins.
They take coins from the circle in turn and every time they could take 1~K continuous coins.
(imagining that ten coins numbered from 1 to 10 and K equal to 3, since 1 and 10 are continuous, you could take away the continuous 10 , 1 , 2 , but if 2 was taken away, you couldn't take 1, 3, 4, because 1 and 3 aren't continuous)
The player who takes the last coin wins the game.
Suppose that those two players always take the best moves and never make mistakes.
Your job is to find out who will definitely win the game.
输入
The first line is a number T(1<=T<=100), represents the number of case. The next T blocks follow each indicates a case.
Each case contains two integers N(3<=N<=109,1<=K<=10).
输出
For each case, output the number of case and the winner "first" or "second".(as shown in the sample output)
样例输入
2
3 1
3 2样例输出
Case 1: first

Case 2: second

这是一道我们学校对外赛的月赛题,比赛时本来我是要做对外的题,听zmh童鞋说,选的大部分都是oj的老题,,于是就没有做对外赛了,直接做了队内的题,结果这道题愣是木做,然后在比赛后我看了这道题,却不知怎么做,不是木思路而是我看见关于数学方面的题我就不想弄,大概是我数学学得不好的原因吧。下面说一下这道题的思路,,,我认为这和我们oj的取石子一挺像的,在这里是把石子连接成环。首先第一直觉感觉后取赢得可能性大些,但凭直觉是不行的,下面简单说一下吧,对于先取的而言,只要取一次,石子环就变成石子链,而后取者只要每次在先取者对称的地方取相同的就行,这里只要先取者有的取,后取者也一定有的取。所以说大部分后取的赢。什么时候先取的赢呢,有两种情况,一是总的石子小于一次取的,其次是最多取连续的一个,并且石子的个数为奇数。

AC代码:

#include<iostream>
#include<string.h>
using namespace std;
int main()
{   int  Case;
    cin>>Case;
    for(int i=1;i<=Case;++i)
    {   int n,m;
         cin>>n>>m;
         if(m>=n||(m==1&&n%2==1)) 
           cout<<"Case "<<i<<": first" <<endl;
           else  cout<<"Case "<<i<<": second" <<endl;
           }return 0;
    }

下面也顺便说一下取石子一把,就是如果可以一次性取完则先取者赢,下面一种情况就是,看总石子数对(k+1)取余是不是为零,如果为零,则后取者赢,否者先取者赢。

这里k为一次最多取的个数。

AC代码:

 
#include<stdio.h>
main()
{
	int n,m,p;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d",&m,&p);
     if(p>=m)
      printf("Win\n");
     else
	 {
     	if(m%(p+1)==0)
	    	printf("Lose\n");
	    else printf("Win\n");
	 }
	}
}
        


django安装mysqlclient (Windows下正确安装mysqlclient) 由于本人也是初学Python和django。本人使用的Python版本是3.7所以连接MySQL数据库需要安装数据驱动,对应Python3的数据驱动是mysqlclient。因此本人习惯性的使用命令pip install mysqlclient,结果安装失败 (venv) C:\Users\songlihui\PycharmProjects\autotest&gt;pip install my... 阅读详情

相关推荐

2021年J题:基于STM32F103的周期信号波形识别与参数测量系统设计(立创EDA+SZPT_ZXL)

本文详细复盘了2021年全国大学生电子设计竞赛J题获奖项目,手把手教你如何基于STM32F103微控制器设计并实现周期信号波形识别与参数测量系统。文章深入剖析了硬件电路设计(包括程控放大、工作点抬升与滞回比较器)与核心软件算法(如动态采样、FFT频谱分析与波形识别逻辑),并分享了DMA传输、FFT库使用等实战要点与避坑指南,为嵌入式信号处理与电赛备赛提供了宝贵经验。

weixin_32673065的博客 230

HDU3951 创建对称局势【博弈水题】2018年ACM-ICPC 南京亚洲区域赛 A题

Coin Game After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.  The game goes like this:  Two players start the game with a circle of n coins.  They ...

紫芝的博客 569

单细胞 | pySCENIC·转录因子分析(二)

接上一篇,pySCENIC分析完之后就可以进行可视化了,个人认为最重要的有三个图:rss点图,rank图,转录因子表达水平热图,3个图结合着看。3.可视化rank图,可以自己改一下plotRSS_oneSet参数让图更好看一点。4. regulon表达水平热图,转录因子表达水平同理,得到的图类似只是输入不一样。2.可视化点图:寻找cluster特异性转录因子。1.loom文件读入R,提取数据。

生信练习生 4283

ACM->uva401

/* 找回文,i != n - i - 1; 镜像 Reverse i != n - i - 1 */ #include #include #include #include using namespace std; char Reverse[35] = { 'A', '#', '#', '#', '3', '#', '#', 'H', 'I', 'L', '#',

Fate_O的专栏 725

大学生智能车竞赛初次尝试经验分享--1(硬件绘制电路,pcb部分)

本人机械电子专业大二暑假参加全国大学生智能车竞赛,之前参加过一些其他类型的比赛有一点基础,由于之前疫情影响所以做智能车比赛断代了,没有学长带也没有思路,从一开始的一头雾水逐渐摸索出我感觉比较实用的经验。 一.首先是硬件的准备工作: 1.硬件部分与要自己设计需要的电路制成pcb。推荐使用Altium Designer20,AD比较常用所以有多实用的教学视频,另外需要自己了解布线规则,包括信号线,电源线常用的宽度 一些电源电路,驱动电路建议用multisim仿真,没有问题再进行制版 单片机有关的需要仿真

weixin_52679034的博客 9834

s9keaz128 UART Bootloader 单片机篇(上)

网络上充斥着各种各样的串口升级方案,基本都是基于Y-Mode协议下载。采用这种升级方案学习还是可以,用在产品上还是有点欠缺。如下载完成后,需要把时间发送到设备就不好搞了。如下这个设备返回的信息,最后一项就是固件更新时间。固件名称: KEA128编译时间固件版本: 1.0.3硬件版本: 1.0.3产品序列号功能名称: App固件更新时间串口升级演示视频。

一人科技 1795

对称博弈(coin game)

Problem Description After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle of n co

EmilSinclair4391的博客 2128

AI智算-K8s+vLLM & Ray:DeepSeek-r1 671B 满血版分布式推理部署实践

自从上次发布 【AI-智算】K8s+SGLang实战:DeepSeek-r1:671b满血版多机多卡私有化部署全攻略] 文章后,本次将演示另一个主流推理引擎工具——vLLM,结合K8s、LWS、Ray、Volcano等技术栈,部署DeepSeek-r1 671b 满血版分布式推理集群,并对比其与SGLang推理引擎的性能表现。

Kason_iWiki 1825

ACM-对称博弈之Coin Game——hdu3951

ACM 对称博弈 Coin Game hdu3951

继续激情,继续奋斗。 2409

库存优化技术提升电商效率

第一部分:库存优化技术基础 第1章:库存优化的基本概念 库存优化是现代电商运营中至关重要的一个环节。简单来说,库存优化指的是通过一系列的策略和技术手段,使得库存管理更加高效、准确,从而降低运营成本,提高销售额。 1.1 库存优化的定义与重要性

AI天才研究院 1248

【Prometheus】prometheus结合cAdvisor监控docker容器运行状态,并且实现实时告警通知

Docker的监控,可以使用Docker自带的stats命令来获取当前主机上运行中的容器的资源使用情况。 例如:容器的CPU使用率、内存占用、网络IO以及磁盘IO等指标。

景天科技苑 6万+

HDU 3951 Coin Game(博弈水题)

Problem Description After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle of n coi

退役的铜牌狗 664

AD-Copilot 论文解读:把“大模型看图”升级为“对照检验”的工业异常检测助手

本文提出AD-Copilot,一个面向工业异常检测的视觉语言助手,通过视觉上下文比较解决现有方法的不足。针对工业场景中多模态大模型表现不佳的问题,作者指出核心原因在于缺乏工业数据和比较能力不足。为此,论文提出三个关键贡献:构建Chat-AD数据集,设计Comparison Encoder显式建模图像差异,以及采用多阶段训练策略。实验表明,该方法在MMAD基准上达到82.29%准确率,定位任务提升3.35倍,并展现出良好的泛化能力。消融实验验证了比较模块的有效性,表明其成功源于高质量比较数据与显式比较模块的协

blanokvaffy的博客 332

Coin Game HDU - 3951 (简单博弈)

Coin Game HDU - 3951 After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with

codeswarrior的博客 526

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

博弈论

                Coin Game After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle o...

weixin_30267691的博客 150

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

hdu 3951 Coin Game (博弈创建对称局势)

Coin GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1652 Accepted Submission(s): 950Problem Description After hh has learned how to pl

滴水穿石,慢慢积累,总会有成果 1231

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

【HDU - 3951】Coin Game (博弈,猜规律,对称博弈)

题干: After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.  The game goes like this:  Two players start the game with a circle of n coins.  They ta...

xuanweiace的博客 833

hdu3951 Coin Game(简单博弈)

Coin Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1627    Accepted Submission(s): 936 Problem Description After hh has learne

随心丶而遇的博客 1700

博弈论-HDU-3951

Description After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.  The game goes like this:  Two players start the game with a circle of n coi

womeidagong的专栏 577

HDU - 3951 - Coin Game(nim博弈)

After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle of n coins. They take coins fr...

Steve·Curcy 266

舍伍德算法改进快速排序

由于快速排序具有不稳定性,最好的时间复杂度为o(nlogn),而最坏可达到o(n^2),为了降低最坏情况出现的概率,可以用舍伍德算法对其进行改进~ #include #include #include #include #include #define N 1000 using namespace std; int a[N]; int Partion(int l,int r) { i

pursuit的专栏 6489

乘法逆元

若对于数字A,C 存在X,使A * X = 1 (mod C) ,那么称X为 A 对C的乘法逆元。 逆元的作用?让我们来看下面的例子: 12 / 4 mod 7 = ? , 很显然结果是3 我们现在对于数对 (4,7), 可以知道 X = 2是 4 对7的乘法逆元即2*4=1(mod 7) 那么我们有(12 / 4) * (4 * 2 ) = (?) * (1) (mod 7) 除法被完

pursuit的专栏 4987

拉斯维加斯算法对n进行因子分解&&n取值范围2 <= N < 2^54

代码:#include #include #include #include #include #include const int S=20; using namespace std; typedef long long LL; #define maxn 10000 LL factor[maxn]; int tot; LL muti_mod(LL a,LL b,LL c){

pursuit的专栏 3006

卡特兰数

卡特兰数 卡特兰数又称卡塔兰数,是组合数学中一个常出现在各种计数问题中出现的数列。由以比利时的数学家欧仁·查理·卡塔兰 (1814–1894)命名。 卡特兰公式的应用很广泛,最典型的四种应用问题现描述如下: 1.括号化问题。   矩阵链乘: P=a1×a2×a3×……×an,依据乘法结合律,不改变其顺序,只用括号表示成对的乘积,试问有几种括号化的方案?(h(n)种)

pursuit的专栏 2965

http://acm.hdu.edu.cn/showproblem.php?pid=1023&&卡特兰数

Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the trains can

pursuit的专栏 2269
上一篇: http://acm.nyist.net/JudgeOnline/problem.php?pid=434
下一篇: 运算符重载
smallacmer
博客等级 码龄15年 112粉丝 425原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值