#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; int n,m; int flag1,flag2; void dfs(int a,int b,int x)
{
if(b==)
{
flag2=;
if(a==) flag1=;
}
if(flag1&&flag2) return;
if(x==) return; if(a%x==) dfs(a/x,b,x-);
if(b%x==) dfs(a,b/x,x-);
dfs(a,b,x-);
} int main()
{
while(~scanf("%d%d",&n,&m))
{
if(n<m) swap(n,m);
flag1=,flag2=;
dfs(n,m,);
if(flag1==&&flag2==) printf("%d\n",m);
else printf("%d\n",n);
}
return ;
}

ZOJ 1003 Crashing Balloon的更多相关文章

  1. [ZOJ 1003] Crashing Balloon (dfs搜索)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3 题目大意:给你a,b两个数,问当b由约数1到100组成时,a能否由其 ...

  2. [ZJU 1003] Crashing Balloon

    ZOJ Problem Set - 1003 Crashing Balloon Time Limit: 2 Seconds      Memory Limit: 65536 KB On every J ...

  3. 1003 Crashing Balloon

    考察DFS的应用,判断两个数的因子. #include <stdio.h> int f1,f2; void DFS(int m,int n,int k){ ){ f2=; ) f1=; } ...

  4. ZOJ1003 Crashing Balloon

    Crashing Balloon Time Limit: 2 Seconds      Memory Limit: 65536 KB On every June 1st, the Children's ...

  5. 【ZOJ1003】Crashing Balloon(DFS)

    Crashing Balloon Time Limit: 2 Seconds      Memory Limit: 65536 KB On every June 1st, the Children's ...

  6. 【Acm】算法之美—Crashing Balloon

    题目概述:Crashing Balloon On every  June 1st, the Children's Day, there will be a game named "crash ...

  7. ZJU-1003 Crashing Balloon dfs,

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3 题意(难以描述):A,B两个人从1~100选数乘起来比谁的大(不能选重复的或者 ...

  8. ZOJ 3981:Balloon Robot(思维+递推)

    题目链接 题意 有n支队在m个位置上做题,有一个机器人位置1到位置m再到位置1循环走派发气球,当队伍a在时间b做完了一道题目的时候,假如机器人走到队伍a的位置的时间为c,那么这个队伍的不开心值就是c- ...

  9. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

随机推荐

  1. xhtml头文件设置

    设置字符集编码: <head> <meta http-equiv="Content-Type" Content="text/html" cha ...

  2. Android设备标识符的使用

    设备ID(DeviceId) 获取办法 android.telephony.TelephonyManager tm = (android.telephony.TelephonyManager) con ...

  3. 【锋利的Jquery】读书笔记六

    ajax优点缺点 json格式的严格 { "people": [ { "firstName": "Brett", "lastNam ...

  4. SDN理解:云数据中心底层网络架构

    目录 - 目录 - 云数据中心流量类型 - NSX整体网络结构 - 管理网络(API网络) - 租户网络 - 外联网络 - 存储网络 - openstack整体网络结构 - 管理网络:(上图中蓝线) ...

  5. R和python连接SQL sever 数据库操作

    在R的使用中,为了方便提取数据, 我们经常要进行数据库进行操作,接下来我们尝试使用R进行连接数据. 这里我们使用R中的RODBC进行操作, 首先,我们需要先配置ODBC资源管理器 通过任务管理器或者w ...

  6. 【转】Hive执行计划

    执行语句 hive> explain select s.id, s.name from student s left outer join student_tmp st on s.name = ...

  7. Ubuntu14.04 bind9配置

    apt-get install bind9 配置域名: cn.archive.ubuntu.com 对应IP: 10.60.233.244 vim /etc/bind/name.conf.defaul ...

  8. glibc漏洞监测并修复

    [CVE 2015-0235: GNU glibc gethostbyname 缓冲区溢出漏洞 ]全面爆发,该漏洞的产生是Qualys公司在进行内部代码审核时,发现了一个在GNU C库(glibc)中 ...

  9. niceScroll接口大全

    Query滚动条插件兼容ie6+.手机.ipad http://www.areaaperta.com/nicescroll/ jQuery(function($){ $("#scrollIn ...

  10. 【锋利的Jquery】读书笔记二

    一.jquery选择器 基本选择器 层次选择器 过滤选择器 基本过滤 内容过滤 可见性过滤 属性过滤 子元素过滤 first  : 获取单个元素       $("div:first&quo ...