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

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

#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. C++字符串(1)

    C++ 拼接字符串常量 C++允许拼接字符串字面值,即将两个用引号括起的字符串合并为一个.事实上,任何两个由空白(空格,制表符和换行符)分隔的字符串常量都将自动拼接成一个. 例子: cout < ...

  2. Android OpenGL ES(三)OpenGL ES API 命名习惯 .

    OpenGL ES是个跨平台的3D图形开发包规范,最常见的实现是采用C语言实现的,Android OpenGL ES 实现上是使用Java 语言对底层的C接口进行了封装,因此在android.open ...

  3. CodeForces 566B Replicating Processes

    #include <bits/stdc++.h> #define N 3010 #define LL long long #define unsigned U using namespac ...

  4. iOS进阶推荐的书目

    <Effective Objective-C 2.0:编写高质量iOS与OS X代码的52个有效方法>([英]Matt Galloway) 很多面试题有涉及 <IOS数据库应用高级编 ...

  5. android apk jarsigner 签名打包

    cmd 命令符打包: 规则:  jarsigner -verbose -keystore 签名路径 -signedjar 签名后的apk存放路径  未签名的apk 签名文件的别名 项目如我的项目是: ...

  6. PAT (Advanced Level) 1113. Integer Set Partition (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  7. HDU 3966 Aragorn's Story 动态树 树链剖分

    Aragorn's Story Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. 设计模式---Manager(管理器)

    设计模式之美:Manager(管理器) 索引 意图 结构 参与者 适用性 效果 实现 实现方式(一):Manager 模式的示例实现. 意图 将对一个类的所有对象的管理封装到一个单独的管理器类中. 这 ...

  9. Ubuntu里字符编码设置

    Ubuntu里字符编码设置   Ubuntu系统在默认的状况下只支持中文UTF-8编码,但是我们写的一些文档,还有java代码编译时采用gbk编码.所以需要修改.步骤如下:  www.2cto.com ...

  10. jquery has deprecated synchronous XMLHTTPRequest

    Like many others, my website is using jquery. When I open the developer tools, I see a warning that ...