考察DFS的应用,判断两个数的因子。

 #include <stdio.h>

 int f1,f2;

 void DFS(int m,int n,int k){
     ){
         f2=;
         )
             f1=;
     }
     )
         return;
     )
         DFS(m/k,n,k-);
     )
         DFS(m,n/k,k-);
     DFS(m,n,k-);
 }

 int main(){
     int a,b,temp;
     ){
         if(a<b){
             temp=a;
             a=b;
             b=temp;
         }
         f1=f2=;
         DFS(a,b,);
         temp=(!f1&&f2)?b:a;
         printf("%d\n",temp);
     }
     ;
 }

1003 Crashing Balloon的更多相关文章

  1. [ZJU 1003] Crashing Balloon

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

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

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

  3. ZOJ 1003 Crashing Balloon

    #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using ...

  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. POJ题目细究

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

  9. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

随机推荐

  1. win8系统intellij输入中文问题

    用上新的intellij,不过在输入汉字时出现后面的被删除,网上找了,没有找到解决方案,只有自己解决了,感觉如果是intellij不兼容win8,那么就不能用intellij,那对于习惯了intell ...

  2. MVC中配置OutputCache的VaryByParam参数无效的问题

    在项目使用OutputCacheAttribute是遇到了问题,当我想在配置文件web.config中配置OutputCache的VaryByParam时竟然不起作用,下面是相关代码: 文件FaceC ...

  3. SED&AWK

    SED   1.sed是流编辑器(stream editor)缩写,作用主要是文本替换 命令格式:sed ‘s/pattern/replace_string/' file或者cat file | se ...

  4. Mysql基础教程——mysql之一

    教程列表:http://www.dxzy163.com/view/index7627.html 41 存储过程 40 全文索引与停止词 39 索引的管 38 索引概念 37 数据库备份与恢复 36 事 ...

  5. Validate Binary Search Tree 解答

    Question Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is d ...

  6. ORACLE 中写入txt文本与从Txt文件中读入数据 修改表结构

    --创建一个表 DROP TABLE TEST CASCADE CONSTRAINTS ; CREATE TABLE TEST(A VARCHAR(30),B VARCHAR(30)); --查看具体 ...

  7. UGUI Silder

    来我们看看这个像温度计的控件, 比如音量面板声音大小的控制.它是一个组合型控件由多个Image 和一个Slider组合而成 它的核心是Slider组件实现的. 简单介绍下Slider组件的属性: Fi ...

  8. HTML标签的offset、client、 scroll和currentStyle属性

    本文来自:http://www.cnblogs.com/quanhai/archive/2010/04/19/1715231.html offsetHeight = borderTopWidth + ...

  9. Android应用程序请求SurfaceFlinger服务渲染Surface的过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/7932268 在前面一篇文章中,我们分析了And ...

  10. 浅谈JavaScript DOM编程艺术读后感和一点总结

    最近工作不是很忙就想想想JavaScript的内部组成和一些要点,就是从这本书开始的.对新手来说还好,简单易懂. 简单终结下我重书中学到的一些要点. 下面都是个人学习的要点提取: 1.给自己预留退路, ...