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

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

#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. HDU 1022 Train Problem I 用栈瞎搞

    题目大意:有n辆火车,按一定的顺序进站(第一个字符串顺序),问是否能按规定的顺序出站(按第二个字符串的顺序出去),如果能输出每辆火车进出站的过程. 题目思路:栈的特点是先进后出,和题意类似,还有有一种 ...

  2. python 函数部分

    #初始化 def init(data): data['first']={} data['middle']={} data['last']={} #查看条件 def lookup(data,label, ...

  3. Android中Edittext的属性

    //此为转载别人的,挺不错的 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true"  ...

  4. excel转化为Json

    Sheet sheet;        Workbook book;        Cell cell1,cell2,cell3,cell4;        JSONArray jsonArray = ...

  5. ORACLE中CHAR、VARCHAR、NVARCHAR

    1. char      固定长度,最长n个字符.   2. varchar      最大长度为n的可变字符串. (n为某一整数,不同数据库,最大长度n不同)   char和varchar区别:   ...

  6. PHP的json_encode中文被转码的问题

    在php5.2中做json_encode的时候.中文会被unicode编码, php5.3加入了options参数, 5.4以后才加入JSON_UNESCAPED_UNICODE,这个参数,不需要做e ...

  7. Zigbee协议栈OSAL层API函数【转载】

              OSAL层提供了很多的API来对整个的协议栈进行管理.主要有下面的几类:信息管理.任务同步.时间管理.中断管理.任务管理.内存管理.电源管理以及非易失存储管理.看到这些管理是不是感 ...

  8. base库

    /* * 跨浏览器基础库=============================================== * */ //浏览器检测 (function () { window.sys = ...

  9. 打造最强Windows Server 2012 给你比Windows 8更好的体验

    每一代微软桌面操作系统推出的时候,都会同步推出相应核心的服务器操作系统,稳定性会更强哈 所以改造一下,让它保留兼容和专业的同时又有桌面操作系统的美观和便捷,多好 咳咳,让我们来看看怎么把Server ...

  10. read cache return null

    http://stackoverflow.com/questions/8063590/unexpected-behaviour-after-memcached-server-restarts-how- ...