ZOJ 1003 Crashing Balloon
2024-10-15 05:55:16
#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 ;
}
最新文章
- OC中copy的使用
- 设置SecureCRT配色和解决乱码问题
- C++ 检测内存泄露工具 -- Windows平台
- 【转】IOS开发资源汇总
- SQL Server 2008 R2——VC++ ADO 操作 存储过程
- 第五节:什么导致Finalize方法被调用
- UIButton的简单操作和实际应用
- 配置Windows 2008 R2 64位 Odoo 8.0/9.0 源码开发调试环境
- PHP 7 新特性
- SQL Server-常用分页语句
- Sysbench&#160;Sysbench在centos系统下的安装
- XML解析技术-dom4j
- Lepus监控之Oracle配置
- 一文学redis操作(记录向)
- linux中断源码分析 - 中断发生(三)
- windows IOCP入门的一些资料
- powerdesigner远程连接数据库
- .net写本地文件的一个方法
- [转帖] 大神 Linus Torvalds 语录
- layui框架遇到时间控件在搜索之后再次点击出现异常的问题
热门文章
- Tomcat v7.0 Server at localhost are already in use,tomcat提示端口被占用,tomcat端口已经被使用,tomcat端口占用
- IDEA导入maven项目的步骤
- nodejs,http,get,post,请求
- Linux 下安裝 MyEclipse
- InnoDB引擎数据存放位置
- 130道C#面试题
- MATLAB &#39; : &#39; 官方解释
- [MFC美化] Skin++使用详解-使用方法及注意事项
- MQTT协议之 Apache Apollo服务
- NGINX----源码阅读---sources配置脚本