题目传送门

 /*
暴力:对于每一个数都判断,是否数字全都使用过一遍
*/
#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. dedecms如何随机调用指定分类下的文章到网站首页

    dedecms是全静态的,有时会因为其他事情好几天没写文章推荐到首页,那样对se不是很友好.原本ytkah是想在网站首页上半部分调用几篇id从200到500的文章随机展示的,这样每次更新首页给se的赶 ...

  2. 第三方br查询工具害人不浅

    第三方br查询工具害人不浅,查询的时候会大批量调用百度的数据库,为什么说是大批量查询呢? 首先是自己查询,心急的站长恨不得下一次刷新br时数值会有所提高,不是那么急的也会一天查一次或几天一次,记录网站 ...

  3. tolua.cast的实用方法

    local name = (tolua.cast(sender, "ccui.Button")):getTitleText()

  4. (11)UI布局和分辨率适配

    一.Cocos编辑器 自动布局系统主要涉及固定与拉伸属性:   如图,总共可以修改控件的上下左右四个图钉和中间的两个拉伸条六个属性. 效果   1.当打开其中的任意一个图钉时,当前节点与父节点的对应边 ...

  5. CocoStudio基础教程(2)关联程序逻辑与cocoStudio导出文件

    1.概述 上篇说到将CocoStudio的导出文件在程序中运行出来,但是并没有用户交互,即点击响应,程序的逻辑判断也都没有.这篇中我们把它们加进去,这样就可以算一个完整的程序了. 2.界面编辑 大部分 ...

  6. First Position of Target

    For a given sorted array (ascending order) and a target number, find the first index of this number ...

  7. python中的引用

    作为一个python初学者,今天被一个python列表和词典引用的问题折磨了很久,但其实了解了缘由也很简单,记录在此备忘. 首先背书python中的引用对象问题: 1. python不允许程序员选择采 ...

  8. Sybase IQ如何将大文件数据迅速加载到数据库

    试想一下,如果一个文件5G.10G甚至更大.如何将它迅速地加载到数据库指定的表呢?我们看看Sybase IQ是如何迅速地将表的数据加载到数据库的. 数据文件格式: 1440,2011-01-09 00 ...

  9. LightOJ 1234 Harmonic Number (打表)

    Harmonic Number Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submi ...

  10. PageBean分页组件

    Page.java package org.guangsoft.bean; import java.util.List; public class Page { private int current ...