题目传送门

 /*
暴力:对于每一个数都判断,是否数字全都使用过一遍
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <queue>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f;
int vis[]; bool ok(int x, int y)
{
memset (vis, , sizeof (vis));
for (int i=; i<=; ++i)
{
vis[x%]++; vis[y%]++;
if (vis[x%] > || vis[y%] > ) return false;
x /= ; y /= ;
} return true;
} int main(void) //UVA 725 Division
{
//freopen ("UVA_725.in", "r", stdin); int n, cnt = ;
while (scanf ("%d", &n) == )
{
if (n == ) break;
if (cnt++) puts (""); int one = ;
for (int i=; i<=/n; ++i)
{
if (i * n > ) break;
if (ok (i, i*n) == true)
{
printf ("%05d / %05d = %d\n", n*i, i, n); one++;
}
} if (!one) printf ("There are no solutions for %d.\n", n);
} return ;
} /*
There are no solutions for 61.
*/

暴力枚举 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. Billboard(线段树)

    Billboard Time Limit:8000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit St ...

  2. [Effective JavaScript 笔记]第61条:不要阻塞I/O事件队列

    js程序是构建在事件之上的.输入可能来自不同的外部源.在一些语言中,我们习惯地编写代码来等待某个特定的输入. var text=downloadSync('http://example.com/fil ...

  3. JetBrains WebStorm 7.0 Build 131.202 Win/Mac/Liniux

    JetBrains WebStorm 7.0 Build 131.202 (Win/Mac/Liniux) | 121.6/106/133 Mb WebStorm 7 — Everything you ...

  4. css用标签选择器在本页写样式

    <title>静夜思</title><style type="text/css">p{ color:#ff0000;   font-size:2 ...

  5. jquery优势

    1.轻量 2.开源 3.选择器出色 可以支持几乎 css1到css3 的所有选择器 4.简单的修改页面    不同的浏览器对于css的支持程度是不同的,jquery通过封装javascript的代码, ...

  6. velocity的string转数字,numberTool

    velocity的string转数字,非常有意思: 1.通过java的包装类进行转换 #set($intString = "20") #set($Integer = 0) $Int ...

  7. python - easy_install的安装和使用

    为什么要装easy_install?正常情况下,我们要给Python安装第三方的扩展包,我们必须下载压缩包,解压缩到一个目录,然后命令行或者终端打开这个目录,然后执行python setup.py i ...

  8. 28. 字符串的全排列之第2篇[string permutation with repeating chars]

    [本文链接] http://www.cnblogs.com/hellogiser/p/string-permutation-with-repeating-chars.html [题目] 输入一个字符串 ...

  9. iOS7 中的新加入的下载类NSURLSession(随ios版本更新而更新)

    想详细的了解网络下载的相关知识,要仔细阅读URL Loading System Programming Guide 这里有篇好文章(http://www.shinobicontrols.com/blo ...

  10. Python网络编程(2)——socket模块(2)

    目录: 1. 异常 2. 地址族 3. 套接字类型 4. 模块方法 5. Socket对象与实例方法 socket模块提供了Python中的低层网络连接接口,用于操作套接字操作. 异常 socket模 ...