coderforce 69D.Dot

本文介绍了一个基于坐标平移和反射的两人回合制游戏,通过深度优先搜索算法确定初始状态下哪位玩家能赢得游戏。游戏规则包括移动点的位置及对角线反射,并限制了超出特定距离的移动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to them to play a game under the code name "dot" with the following rules:

  • On the checkered paper a coordinate system is drawn. A dot is initially put in the position (x, y).
  • A move is shifting a dot to one of the pre-selected vectors. Also each player can once per game symmetrically reflect a dot relatively to the line y = x.
  • Anton and Dasha take turns. Anton goes first.
  • The player after whose move the distance from the dot to the coordinates' origin exceeds d, loses.

Help them to determine the winner.

Input

The first line of the input file contains 4 integers x, y, n, d ( - 200 ≤ x, y ≤ 200, 1 ≤ d ≤ 200, 1 ≤ n ≤ 20) — the initial coordinates of the dot, the distance d and the number of vectors. It is guaranteed that the initial dot is at the distance less than d from the origin of the coordinates. The following n lines each contain two non-negative numbers xi and yi (0 ≤ xi, yi ≤ 200) — the coordinates of the i-th vector. It is guaranteed that all the vectors are nonzero and different.

Output

You should print "Anton", if the winner is Anton in case of both players play the game optimally, and "Dasha" otherwise.

Sample Input

DFS记录路径的博弈,很好的一道题。

Input
0 0 2 3
1 1
1 2
Output
Anton
Input
0 0 2 4
1 1
1 2
Output
Dasha
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int mapp[500][500];
int a[300],b[300],bx,by,d,n;
int dfs(int x,int y)
{
    if((x-250)*(x-250)+(y-250)*(y-250)>=d*d)
        return 1;
    if(mapp[x][y]!=-1)
        return mapp[x][y];
    for(int i=0; i<n; i++)
    {
        if(dfs(x+a[i],y+b[i])==0)
            return mapp[x][y]=1;
    }
    return mapp[x][y]=0;
}
int main()
{
    cin>>bx>>by>>n>>d;
    bx+=250;
    by+=250;
    for(int i=0; i<n; i++)
        scanf("%d%d",&a[i],&b[i]);
    memset(mapp,-1,sizeof(mapp));
    if(dfs(bx,by))
        printf("Anton\n");
    else
        printf("Dasha\n");
    return 0;
}

内容概要:本文档《x86汇编指令.pdf》是一份简明的x86汇编语言教程,涵盖了从基础到高级的主题。首先介绍了汇编语言及其重要性,接着详细讲解了处理器的基本寄存器、实模式与保护模式下的内存操作、子程序和中断的使用、编译优化技术以及Linux下的x86汇编编程。文档还深入探讨了x86汇编指令集,包括数据传输、算术运算、逻辑运算、串操作、程序转移、伪指令、位操作和处理器控制指令。最后,文档介绍了GCC内联汇编的基础,包括AT&T汇编语法、内联汇编的基本形式和扩展形式、约束条件(constra)的使用以及一些实用的例子。 适合人群:具备一定编程基础,尤其是熟悉结构化程序设计语言的读者,如C/C++程序员,以及对底层编程和计算机架构感兴趣的开发者。 使用场景及目标:①帮助读者深入了解计算机内部运行机制,提高调试能力和程序性能;②掌握x86汇编语言的核心概念和技术,以便在需要高性能代码或硬件交互的场景中应用;③学习如何利用GCC内联汇编技术优化关键代码段,增强程序的执行效率。 其他说明:本文档不仅适合自学,也适用于有一定编程经验的开发者深入研究汇编语言。学习汇编语言不仅能提升对计算机底层的理解,还能为编写高效、稳定的程序打下坚实基础。文档强调了汇编语言的复杂性和挑战性,鼓励读者在实践中不断探索和创新。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值