Gym - 100947F

本文介绍了一个简单的博弈游戏,其中两名玩家轮流移动黑白两颗棋子,目标是在对手无法移动时获胜。文章分析了游戏的制胜策略,并指出当两棋子间的距离为偶数时,先手玩家必胜。
F. black-white
time limit per test
2 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

Steven met his old friend Mikael yesterday and he told him about a very interesting game. The game board is made of N cells aligned in a row , and two colored stones in two different fixed positions of this row. The first stone is white, and the second is black. Steven plays with the white stone, and Mikael plays with the black one.

The two players play alternately, Each player in his turn can move his stone one cell to the right or to the left, but he cannot move it outside the board or onto a cell occupied by the other player. Steven goes first. The player who cannot make any move loses.

Steven and Mikael have become very good at playing this game, so they can know the winner of the game just by looking at the starting state of the board. Can you do the same?

You are given the initial game board and you should know who is the winner of this match, considering both players playing optimally (if both players play optimally the game will end).

Input

The first line of input is an integer T which represents the number of test cases. Each of the next T lines consists three integers N , W , B , the length of the game board , the position of the white stone , the position of the black stone (2  ≤  N  ≤  100000) (1  ≤  B , W  ≤  N)

Output

For each test case, output a single line representing its answer; if Steven is the winner output "Steven" (without quotes) otherwise"Mikael" (without quotes).

Examples
input
1
11 4 8
output
Steven

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


#define LL long long
#define INF 0x3f3f3f3
#define pi acos(-1)
#define endl '\n'
#define me(x) memset(x,0,sizeof(x));
const int maxn=1e3+5;
const int maxx=1e6+5;


int T,N,W,B;
int main()
{
    cin>>T;
    while(T--)
    {
        cin>>N>>W>>B;
        if((W-B)%2==0)
            puts("Steven");
        else puts("Mikael");
    }
}



大意:看样例一猜就是一个博弈,在一行格子中,有一个白棋和一个黑旗,每次移动一个,给出一个状态,白棋先移动,问最后胜利的人是谁。

分析:只要白棋和黑棋始终保持奇数的间隔(即轮到白棋走的时候,黑白间隔奇数个),最后黑棋一定会被逼到角落,然后间隔不断减小(减小之和还是奇数间隔),最后黑棋败。

所以判断白棋和黑棋的距离是否是偶数间隔就完了。

【源码免费下载链接】:https://renmaiwang.cn/s/2gdnj 《R语言数据挖掘方法及应用》由薛薇编写而成的一本系统阐述R语言在数据挖掘领域前沿技术的著作。该书旨在指导读者学会使用R语言进行高效、实用的数据分析与建模工作,涵盖了从理论基础到实践操作的全过程。作为一款功能强大且开源的统计计算和图形处理平台,R语言凭借其丰富的工具库和社区支持,在数据分析与可视化方面展现出显著优势。在数据挖掘领域,R语言提供了包括`caret`、`randomForest`、`tm`、`e1071`等广泛使用的专用包,这些工具能够帮助用户更便捷地进行数据预处理、特征选择、模型构建和结果评估。全书首先介绍R语言的基本知识体系,涵盖环境配置与安装方法、基础语法规范以及常见数据类型分析等内容。这些基础知识是开展后续数据分析工作的必备技能,通过学习可以快速掌握R语言的核心功能。随后章节深入讲解了数据挖掘的主要概念与流程,包括数据清洗、转换整理和探索性分析等环节,同时详细阐述了分类、聚类、关联规则挖掘及预测等多种典型任务的具体实施方法。这些内容有助于读者全面理解数据挖掘的整体架构及其核心工作步骤。在应用实践部分,薛薇老师结合真实案例展示了R语言在实际业务场景中的具体运用,例如市场细分分析、客户流失预测以及个性化推荐系统等。通过这些案例研究,读者可以深入学习如何利用相关工具包解决实际问题,并提升数据分析能力。此外,书中配套的“案例数据集”和“代码资源”为读者提供了实践操作的机会,使理论知识能够更好地转化为动手技能。通过实际操作分析,读者可以加深对R语言数据挖掘方法的理解并灵活运用。总之,《R语言数据挖掘方法及应用》是一部全面讲解R语言在数据分析与建模领域的教材,无论你是刚开始学习的新人还是经验丰富的专业人士,都能从中获益匪浅。通过深入研读此书,你可以掌握R语言的数据挖掘技巧,并将其应用到实
内容概要:本文提出了一种基于改进粒子滤波算法的无人机三维航迹预测方法,并通过Matlab代码实现仿真验证。该方法针对传统粒子滤波在无人机轨迹预测中存在的粒子退化和计算复杂度高等问题,引入优化策略提升滤波精度与效率,有效提高了对无人机运动轨迹的非线性、非高斯环境下的预测能力。文中详细阐述了算法原理、模型构建流程及关键步骤,包括状态转移建模、观测方程设计、重采样优化等,并结合三维空间中的实际飞行轨迹进行仿真实验,验证了所提方法相较于标准粒子滤波在位置预测误差和收敛速度方面的优越性。; 适合人群:具备一定信号处理、导航估计算法基础,熟悉Matlab编程,从事无人系统、智能交通、航空航天等相关领域研究的研究生或科研人员; 使用场景及目标:①应用于无人机实时轨迹预测与状态估计系统中,提升飞行安全性与自主性;②为复杂环境下非线性动态系统的建模与滤波算法研究提供技术参考;③【预测】改进粒子滤波的无人机三维航迹预测方法(Matlab代码实现)支持后续扩展至多无人机协同跟踪与避障系统的设计与仿真; 阅读建议:建议结合Matlab代码逐模块分析算法实现细节,重点关注粒子滤波的改进机制与三维可视化结果对比,同时可尝试替换不同运动模型或噪声条件以深入理解算法鲁棒性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值