#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. Unity Get Thread Content Failed

    最近在使用Unity做项目时,发现总是莫名的出现“Get Thread Content Failed”的消息弹出,然后Unity就卡死了,这样反反复复,后来查到是因为一些杀毒软件在阻止Unity,尝试 ...

  2. Linux环境搭建Hadoop伪分布模式

    Hadoop有三种分布模式:单机模式.伪分布.全分布模式,相比于其他两种,伪分布是最适合初学者开发学习使用的,可以了解Hadoop的运行原理,是最好的选择.接下来,就开始部署环境. 首先要安装好Lin ...

  3. 黄聪:VPS服务器好备份工具配置

  4. python绝技 — 侦听802.11 Probe请求

    代码 #!/usr/bin/python #--*--coding=utf-8--*-- from scapy.all import * interface = 'wlan1' probeReqs = ...

  5. JUnit4单元测试基础篇

    引言 JUnit作为Java语言的测试框架,在测试驱动开发(TDD)下扮演重要的角色.众所周知,无论开发大型项目还是一般的小型项目, 单元测试都至关重要.单元测试为软件可发测试维护提供了很大的便利.J ...

  6. Ch2 空间配置器(allocator) ---笔记

    2.1 空间配置器的标准接口 allocator的必要接口: allocator::value_type allocator::pointer allocator::const_pointer all ...

  7. Token注解防止表单的重复提交

    注解的一些基础: 参见http://blog.csdn.net/duo2005duo/article/details/50505884和 http://blog.csdn.net/duo2005duo ...

  8. 开通域名绑定DDNS

    一.初衷 我想要有一个自己的域名,然后有自己的server,在server上搭一个网站或者开通一个ftp服务,我想通过这个域名来访问它. 二.什么是DDNS DDNS 动态dns,电信宽带采用拨号联网 ...

  9. [MFC美化] USkin使用详解-使用方法

    该种皮肤库资料很少,用法与前面几种类似. 它主要有:USkin.dll ,USkin.lib,USkin.h和Sakura.msstyles这四个文件.皮肤格式是.u3.SkinBuilder是USk ...

  10. LoadLibraryW 参数问题

    error C2664: "LoadLibraryW": 不能将参数1 从"const char [8]"转换为"LPCWSTR" 右击工程 ...