【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

枚举分母从0到99999.
得到分子,判断合法

【代码】

/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
*/ #include <bits/stdc++.h>
using namespace std; int n;
vector <int> v1,v2,v3; int main(){
#ifdef LOCAL_DEFINE
freopen("F:\\c++source\\rush_in.txt", "r", stdin);
freopen("F:\\c++source\\rush_out.txt", "w", stdout);
#endif
ios::sync_with_stdio(0),cin.tie(0); int kase = 0;
while (cin >>n && n){
if (kase>0) cout << endl;
kase++;
int cnt = 0;
for (int i = 1;i <= 99999;i++){
int x = i*n;
int y = i;
v1.clear(),v2.clear();
for (int i = 1;i <= 5;i++){
v1.push_back(x%10);
x/=10;
}
for (int i = 1;i <= 5;i++){
v2.push_back(y%10);
y/=10;
}
if (x>0) continue;
v3.clear();
for (int x:v1) v3.push_back(x);
for (int x:v2) v3.push_back(x);
sort(v3.begin(),v3.end());
int temp1 = unique(v3.begin(),v3.end()) - v3.begin();
if (temp1==10){
cnt++;
for (int i = 4;i >= 0;i--) cout << v1[i];
cout <<" / ";
for (int i = 4;i >= 0;i--) cout << v2[i];
cout <<" = "<<n<<endl;
}
}
if (cnt==0){
cout <<"There are no solutions for "<<n<<"."<<endl;
}
}
return 0;
}

【例题 7-1 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

    0.不要傻傻的用递归去构造出一个五位数来,直接for循环最小到最大就好,可以稍微剪枝一丢丢,因为最小的数是01234 从1234开始,因为倍数n最小为2 而分子是一个最多五位数,所以分母应该小于五万. ...

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

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABVMAAAOHCAIAAAClwESxAAAgAElEQVR4nOydybGturJFcQEPfgQu4A

  7. UVA 725 – Division

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

  8. uva 725 DIVISION (暴力枚举)

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

  9. UVA 725 division【暴力枚举】

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

  10. UVa 725 Division (枚举)

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

随机推荐

  1. 最近学习了一下DeepLearning,发现时NB。

    持续关注,有空放个算法到线上的推荐上.

  2. 洛谷 P3130 [USACO15DEC]计数haybalesCounting Haybales

    P3130 [USACO15DEC]计数haybalesCounting Haybales 题目描述 Farmer John is trying to hire contractors to help ...

  3. 11.2.0.1升级到11.2.0.4报错之中的一个:UtilSession failed: Patch 9413827

    UtilSession failed: Patch 9413827 requires component(s) that are not installed in OracleHome. These ...

  4. Log4j2 与 SpringMVC 整合

    log4j2不仅仅是log4j的简单升级,而是整个项目的重构.官网地址:http://logging.apache.org/log4j/2.x/,大家能够从官网的介绍看出它相比log4j第1代的种种长 ...

  5. 深入解析开源项目之Universal-Image-Loader(二)硬盘---缓存篇

    文件命名: FileNameGenerator,HashCodeFileNameGenerator,Md5FileNameGenerator package com.nostra13.universa ...

  6. c++中重载、重写、覆盖的区别

    Overload(重载):在C++程序中,可以将语义.功能相似的几个函数用同一个名字表示,但参数或返回值不同(包括类型.顺序不同),即函数重载.(1)相同的范围(在同一个类中):(2)函数名字相同:( ...

  7. js中常用的对象—Array的属性和方法

    今天说一下,js中常用的内置对象——Array对象 Array常用属性: length prototype :给系统对象添加属性和方法 Array常用方法: Array.prototype.sum = ...

  8. qgis显示引擎研究(一)

    作者:朱金灿 来源:http://blog.csdn.net/clever101 Qgis是一个著名的开源地理信息系统软件.今天研究了一下它的显示那一块,算是有一点眉目了. 在Windows环境下所有 ...

  9. golang binarySearch

    func binarySearch(nodes []*node, word Text) (int, bool) { start := end := len(nodes) - // 特例: { // 当 ...

  10. 手机浏览器,微信浏览器对background-color不显示的问题

    PC上的浏览器可以正常显示,但是到了手机上就不显示了,古怪的问题花了我一晚上都没解决. 今天突然想到会不会是某些特立独行的了浏览器为了彰显个性,采用不同别人的解析方式呢? 我的原来CSS是这么写的: ...