题目传送门

  1. /*
  2. 暴力:对于每一个数都判断,是否数字全都使用过一遍
  3. */
  4. #include <cstdio>
  5. #include <iostream>
  6. #include <algorithm>
  7. #include <cmath>
  8. #include <cstring>
  9. #include <string>
  10. #include <map>
  11. #include <set>
  12. #include <queue>
  13. using namespace std;
  14. const int MAXN = 1e4 + ;
  15. const int INF = 0x3f3f3f3f;
  16. int vis[];
  17. bool ok(int x, int y)
  18. {
  19. memset (vis, , sizeof (vis));
  20. for (int i=; i<=; ++i)
  21. {
  22. vis[x%]++; vis[y%]++;
  23. if (vis[x%] > || vis[y%] > ) return false;
  24. x /= ; y /= ;
  25. }
  26. return true;
  27. }
  28. int main(void) //UVA 725 Division
  29. {
  30. //freopen ("UVA_725.in", "r", stdin);
  31. int n, cnt = ;
  32. while (scanf ("%d", &n) == )
  33. {
  34. if (n == ) break;
  35. if (cnt++) puts ("");
  36. int one = ;
  37. for (int i=; i<=/n; ++i)
  38. {
  39. if (i * n > ) break;
  40. if (ok (i, i*n) == true)
  41. {
  42. printf ("%05d / %05d = %d\n", n*i, i, n); one++;
  43. }
  44. }
  45. if (!one) printf ("There are no solutions for %d.\n", n);
  46. }
  47. return ;
  48. }
  49. /*
  50. There are no solutions for 61.
  51. */

暴力枚举 UVA 725 Division的更多相关文章

  1. UVA.725 Division (暴力)

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

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

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

  3. uva 725 Division(暴力模拟)

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

  4. UVA 725 division【暴力枚举】

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

  5. uva 725 DIVISION (暴力枚举)

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

  6. UVa 725 Division (枚举)

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

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

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABVMAAAOHCAIAAAClwESxAAAgAElEQVR4nOydybGturJFcQEPfgQu4A

  8. 暴力枚举 UVA 10976 Fractions Again?!

    题目传送门 /* x>=y, 1/x <= 1/y, 因此1/k - 1/y <= 1/y, 即y <= 2*k */ #include <cstdio> #inc ...

  9. UVA 725 – Division

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

随机推荐

  1. Java中的异常

    一.什么是异常 异常就是在程序的运行过程中所发生的不正常的事件,如所需文件找不到,网络连接不通或中断,算术运算出错(如被0除),数组下标越界,装载了一个不存在的类,对null的操作,类型转换异常等等. ...

  2. show slave各项参数解释

    how slave status 各个参数的解释 -- mysql 分类: mysql基础2012-08-23 11:03 2315人阅读 评论(0) 收藏 举报 服务器sslfilesqltable ...

  3. Linux文件权限管理(持续更新)

    文章是从我的个人博客上粘贴过来的, 大家也可以访问我的主页 www.iwangzheng.com 以root身份登录linux以后, ls -al 可以看到 -rw-rw-r--  1 wangzhe ...

  4. k-means

    参考:http://www.cnblogs.com/jerrylead/archive/2011/04/06/2006910.html k-means是无监督的聚类算法,比较简单,但包含的思想不简单, ...

  5. poj1328贪心 雷达,陆地,岛屿问题

    Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 60381   Accepted: 13 ...

  6. 菜单栏展开和收起效果(纯js)

    2014年6月25日 15:36:29 需要关注的是: 1.用cookie保存用户当前点击的菜单项,不打扰后端代码 2.通过数学计算得到要显示和隐藏的div 3.点击事件是动态绑定到a标签上的,因此当 ...

  7. HDU4870 Rating(概率)

    第一场多校,感觉自己都跳去看坑自己的题目里去了,很多自己可能会比较擅长一点的题目没看,然后写一下其中一道概率题的题解吧,感觉和自己前几天做的概率dp的思路是一样的.下面先来看题意:一个人有两个TC的账 ...

  8. July 16th, Week 29th Saturday, 2016

    A long road tests a horse's strength and a long task proves a man's heart. 路遥知马力,日久见人心. Do you have ...

  9. navicat使用跳板机连接数据库-ssh

    1. 目标数据库的域名/IP,端口,用户名,密码:如图1 2. 这时候不要点OK!选择SSH这个tab 3. 选中User SSH Tunnel:填写跳板机域名/IP,用户名,密码(注意:端口22不要 ...

  10. Android中make命令

    转自:http://blog.sina.com.cn/s/blog_abc7e49a01011y0n.html 1.make -jXX  XX表示数字,这个命令将编译Android系统并生成镜像,XX ...