题目传送门

 /*
暴力:对于每一个数都判断,是否数字全都使用过一遍
*/
#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. 响应式js幻灯片代码一枚

    网站搭建经常会用到js幻灯片轮播,放上几张上档次的美图,为你的爱站增添大气元素.经常看到一些js幻灯片代码,但是感觉不是很美观,有的也不支持自适应缩放,也即是响应式,现在智能手机的普及以及移动浏览器技 ...

  2. Python webpy微信公众号开发之 回复图文消息

    新建图文回复模板reply_pictext.xml: $def with (toUser,fromUser,createTime,title1,description1,picurl1,url1)&l ...

  3. [Effective JavaScript 笔记]第57条:使用结构类型设计灵活的接口

    想象创建wiki的库.wiki网站包含用户可以交互式地创建.删除和修改的内容.许多wiki都以简单.基于文本标记语言创建内容为特色.通常,这些标记语言只提供了HTML可用功能的一个子集,但是却有一个更 ...

  4. 在CentOS 7 上搭建LAMP

    导读 要求:httpd的动态和静态资源分为两台主机提供,mysql也用单独一台主机.httpd服务提供虚拟主机,一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress.安装 ...

  5. Stanford机器学习---第六讲. 怎样选择机器学习方法、系统

    原文:http://blog.csdn.net/abcjennifer/article/details/7797502 本栏目(Machine learning)包括单参数的线性回归.多参数的线性回归 ...

  6. 【消息队列MQ】各类MQ比较

    目录(?)[-] RabbitMQ Redis ZeroMQ ActiveMQ JafkaKafka 目前业界有很多MQ产品,我们作如下对比: RabbitMQ 是使用Erlang编写的一个开源的消息 ...

  7. 【leetcode】String to Integer (atoi)

    String to Integer (atoi) Implement atoi to convert a string to an integer. Hint: Carefully consider ...

  8. object-c 系列教程

    1.object-c 基本数据类型 2.object-c 控制语句 3.object-c面向对象1 4.object-c面向对象2 5.object-c 继承多态 动态数据类型

  9. iOS 端的第三方语音识别库

    最近在看语音识别方面的库,主要看了2个收费的项目,一个是 At&t 的,一个是Nuance的.这2个项目虽然是收费的,但是仅仅测试的话,是免费的,连接如下 https://developer. ...

  10. iOS 定制controller过渡动画 ViewController Custom Transition使用体会

    最近学习了一下ios7比较重要的一项功能,就是 controller 的 custom transition. 在ios7中,navigation controller 中就使用了交互式过渡来返回上级 ...