0.不要傻傻的用递归去构造出一个五位数来,直接for循环最小到最大就好,可以稍微剪枝一丢丢,因为最小的数是01234 从1234开始,因为倍数n最小为2 而分子是一个最多五位数,所以分母应该小于五万。 所以for 1234 到50000-1就行了。哦还有个同理,fenmu*n>=十万的可以直接扔掉了

1.还有个判断重复的时候直接这样就好了

while(i)
    {
            num[i%]=;
            i/=;
    }
    while(j)
    {
            num[j%]=;
            j/=;
    }
    ;i<;i++)
        num[]+=num[i];
    ]==)
    {
        printf("%d / %05d = %d\n",fenzi,fenmu,n);
        ok=true;
    }

2.别忘了  当分子小于一万的时候 记得num[0]=1  0是被用掉的这时候

3.!!!scanf控制格式的时候 真的 真的 真的 很好用  %nd (n是一个数字)  就代表着输出%d那个数字 然后不足n位 从左边开始用空格补全   %0nd 就代表着输出%d那个 数字 然后不足n位 从左边开始用0补全

 #include <cstdio>
 #include <cstring>
 int n;
 bool ok;
 ];
 void solve(int i,int j)
 {
     int fenmu=i,fenzi=j;
     ) num[]=;
     while(i)
     {
             num[i%]=;
             i/=;
     }
     while(j)
     {
             num[j%]=;
             j/=;
     }
     ;i<;i++)
         num[]+=num[i];
     ]==)
     {
         printf("%d / %05d = %d\n",fenzi,fenmu,n);
         ok=true;
     }
 }
 int main()
 {
     ;
     while(~scanf("%d",&n))
     {
         ) break;
         if(flag) printf("\n");
         flag=;

         ok=false;
         ;i<;i++)
         {
             memset(num,,sizeof(num));
             int j=i*n;
             ) continue;
             solve(i,j);
         }
         if(!ok) printf("There are no solutions for %d.\n",n);
     }
     ;
 }

Uva 725 Division的更多相关文章

  1. 暴力枚举 UVA 725 Division

    题目传送门 /* 暴力:对于每一个数都判断,是否数字全都使用过一遍 */ #include <cstdio> #include <iostream> #include < ...

  2. uva 725 Division(除法)暴力法!

    uva 725  Division(除法) A - 暴力求解 Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & ...

  3. UVA.725 Division (暴力)

    UVA.725 Division (暴力) 题意分析 找出abcdefghij分别是0-9(不得有重复),使得式子abcde/fghij = n. 如果分别枚举每个数字,就会有10^10,肯定爆炸,由 ...

  4. uva 725 Division(暴力模拟)

    Division 紫书入门级别的暴力,可我还是写了好长时间 = = [题目链接]uva 725 [题目类型]化简暴力 &题解: 首先要看懂题意,他的意思也就是0~9都只出现一遍,在这2个5位数 ...

  5. uva 725 division(水题)——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABVMAAAOHCAIAAAClwESxAAAgAElEQVR4nOydybGturJFcQEPfgQu4A

  6. UVA 725 – Division

    Description   Write a program that finds and displays all pairs of 5-digit numbers that between them ...

  7. uva 725 DIVISION (暴力枚举)

    我的56MS #include <cstdio> #include <iostream> #include <string> #include <cstrin ...

  8. UVA 725 division【暴力枚举】

    [题意]:输入正整数n,用0~9这10个数字不重复组成两个五位数abcde和fghij,使得abcde/fghij的商为n,按顺序输出所有结果.如果没有找到则输出“There are no solut ...

  9. UVa 725 Division (枚举)

    题意 : 输入正整数n,按从小到大的顺序输出所有形如abcde/fghij = n的表达式,其中a-j恰好为数字0-9的一个排列(可以有前导0),2≤n≤79. 分析 : 最暴力的方法莫过于采用数组存 ...

随机推荐

  1. uva 1584.Circular Sequence

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  2. 通过JavaScript操作HTML中select标签

    添加: Js代码 1.function selectChange() 2.{ 3.var sel=document.getElementById("select1"); 4. Op ...

  3. Windows下批处理执行MySQL脚本文件

    转载至http://my.oschina.net/u/660932/blog/117929 一. @echo offSetlocal enabledelayedexpansion::CODER BY ...

  4. sqlserver 动态行转列

    DECLARE @SQL VARCHAR(8000)SET @SQL = 'select overcode 'SELECT @SQL = @SQL + ' , max(case header when ...

  5. 好用的php类库和方法

    1, /** * 将一个平面的二维数组按照指定的字段转换为树状结构 * * 用法: * @code php * $rows = array( * array('id' => 1, 'value' ...

  6. C++静态代码分析PreFast

    1历史 Prefast是微软研究院提出的静态代码分析工具.主要目的是通过分析代码的数据和控制信息来检测程序中的缺陷.需要强调的是,Prefast检测的缺项不仅仅是安全缺陷,但是安全缺陷类型是其检测的最 ...

  7. September 11th 2016 Week 38th Sunday

    Nothing happens unless first a dream. 一切始于梦想. When everything seems to be going against you, remembe ...

  8. Mysql undo与redo Log

    http://mysql.taobao.org/monthly/2015/04/01/ http://www.cnblogs.com/Bozh/archive/2013/03/18/2966494.h ...

  9. redis配置详情

    # Redis configuration file example # Note on units: when memory size is needed, it is possible to sp ...

  10. Index on DB2 for z/OS: DB2 for z/OS 的索引

    可以创建在任何表上的索引: Unique Index:An index that ensures that the value in a particular column or set of col ...