很简单的博弈题.....算几组能得到规律了。

某个状态先手要赢 等价于 之前有一种状态是后手赢,先手可以保证让现在这个状态到达那个状态

#include<cstdio>
#include<cstring>
#include<ctime>
#include<algorithm>
using namespace std; const int maxn = + ;
int a[maxn], b[maxn];
int n, m; int gcd(int a, int b)
{
int t;
while (b)
{
t = a%b;
a = b;
b = t;
}
return a;
} void init()
{
for (int i = ; i <= ; i++) a[i] = i, b[i] = i;
for (int i = ; i <= ; i = i + )
{
swap(b[i - ], b[i - ]);
}
b[] = ; } int main()
{
init();
while (~scanf("%d%d", &n, &m)){
int tot = ;
for (int i = ; i <= ; i++)
if (a[i] <= n&&b[i] <= m) tot++; int fz, fm;
fz = tot;
fm = m*n;
if (tot == ) fz = , fm = ;
else
{
int a=fz / gcd(fz, fm),b = fm / gcd(fz, fm);
fz = a; fm = b;
}
printf("%d/%d\n", fz, fm);
}
return ;
}

HUST 1372 marshmallow的更多相关文章

  1. mysql 错误 ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number 解决办法

    MySQL创建用户(包括密码)时,会提示ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number: 问题原因: ...

  2. Android 6编译环境搭建 (Marshmallow)

    1.安装 ubuntu 14.03 尽管android推荐 ubuntu 15, 安全起见,还是装LTS的14.04,步骤跳过 2. JDK: Marshmallow 需要 JDK8 ,添个源,顺手配 ...

  3. HUST 1017 - Exact cover (Dancing Links 模板题)

    1017 - Exact cover 时间限制:15秒 内存限制:128兆 自定评测 5584 次提交 2975 次通过 题目描述 There is an N*M matrix with only 0 ...

  4. hiho #1372:平方求 (bfs)

    #1372 : 平方求和 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 对于一个非负整数n,最少需要几个完全平方数,使其和为n? 输入 输入包含多组数据.对于每组数据: ...

  5. ubuntu 16.04 source (HUST and 163)

    #HUST deb http://mirrors.hust.edu.cn/ubuntu/ xenial main restricted universe multiverse deb http://m ...

  6. Dancing Link --- 模板题 HUST 1017 - Exact cover

    1017 - Exact cover Problem's Link:   http://acm.hust.edu.cn/problem/show/1017 Mean: 给定一个由0-1组成的矩阵,是否 ...

  7. hust 1010 最短循环节点

    题目链接:http://acm.hust.edu.cn/problem/show/1010 KMP失配指针的利用: next数组前缀和后缀最长公共长度,这样len - next[len];就是最短的循 ...

  8. Android 6 Marshmallow USB调试授权

    Google在Android在5.1版之后进行了重大变革,推出了Android 6 Marshmallow,我们先看看当它接上工作站时,有什么样的状况出现. 如图1所示,会弹出一个窗口,[是否允许此计 ...

  9. android开发者博客二月-Marshmallow and User Data

    又是一篇翻译,这篇快了很多,不过也花了快一个小时,可能熟悉一点.关于6.0权限的,让你做用户认为正确的事情. Marshmallow and UserData 2016,2,1 棉花糖和用户数据 由J ...

随机推荐

  1. 用for、while、do-while循环输出10句“好好学习,天天向上!”

    #include "stdio.h" void main() { int time; ;time<=;time++) printf("%d.好好学习,天天向上!\n ...

  2. Python中元素定位探讨

    以下以阿里云(10.10.1.11)系统中考试答题为例进行了python脚本的编写研究.模糊定位(定位一些动态值): ————————————————————————————————————————— ...

  3. c++数组指针bug

    ClassA* csList = ]; ClassA ca = csList[]; ca.x=; CCLOG(].x);//output: caList[0].x -431602080.000000 ...

  4. hadoop yarn 易理解

    Hadoop 和 MRv1 简单介绍 Hadoop 集群可从单一节点(其中所有 Hadoop 实体都在同一个节点上运行)扩展到数千个节点(其中的功能分散在各个节点之间,以增加并行处理活动).图 1 演 ...

  5. O(n)线性时间找第K大,中位数

    运用快速排序的思想,可以达到线性时间找到一串数的第K大 #include<cstdio> #define F(i,a,b) for(int i=a;i<=b;i++) ],n; vo ...

  6. 卸载get-apt安装的软件

    我们都知道安装软件最简单的方法是apt-get install,但是卸载就不常用了,如何卸载呢? sudo apt-get remove android-tools-adb

  7. Linux下find命令用法小结

    find是个使用频率比较高的命令.常常用它在系统特定目录下,查找具有某种特征的文件. find命令的格式:find [-path……] -options [-print -exec -ok] path ...

  8. 操,escape sequence的输入方法我以前找过一次,这次又忘了,又找了一次,记下来,

    所有的手册和回答都没有说,都是用 echo -e '\e[22;22m,如果不愿意使用echo -e,也可以 输入CvC[[22:22m 不要再忘记了.

  9. C#入门经典(2-重置窗体布局,界面介绍,错误列表)

  10. Ubuntu新建用户

    新建用户的命令是useradd,修改密码是passwd,如下: sudo useradd linc sudo passwd linc 但是问题出现了,home目录下并没有相对应的linc目录. 原来u ...