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

【题意】

在这里输入题意

【题解】

枚举分母从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. Centos/RHEL :How to add,delete and display LVM tags

    1. 什么是LVM标签? 在你想开机启动时让逻辑卷被激活可用时,添加lvm标签是一个不错的选择.lvm标签允许那些被预先标记的实现这样的效果. 2. 配置文件 配置文件/etc/lvm/lvm.con ...

  2. 【Henu ACM Round#18 A】 Multiplication Table

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 遍历i从1..n 看看x%i==0以及x/i<=n是否成立. [代码] #include <iostream> u ...

  3. Linux系统消息队列框架Kafka单机安装配置

    http://www.ithao123.cn/content-11128587.html

  4. C# Arcgis Engine 捕捉功能实现

    namespace 捕捉 { public partial class Form1 : Form { private bool bCreateElement=true; ; ; private IEl ...

  5. js---对象 和 函数this

    一:对象创建的方法 //普通 字面量形式 var obj = { name:'名字', fn:function(){ console.log(this.name); } } //new 实例 var ...

  6. go语言的一个gui 开源 项目 https://github.com/andlabs/ui

    go语言的一个gui 开源 项目  https://github.com/andlabs/ui 1 安装  mingw-w64  链接地址: http://mingw-w64.sourceforge. ...

  7. 【canvas】跟随鼠标的星空连线

    2019-01-23 19:57:38 挂一个比较简单的一个canvas应用,利用CPU进行粒子实时计算,直接面向过程写的 帧动画:浏览器在下一个动画帧安排一次网页重绘,  requestAnimat ...

  8. 如何在win10上同时安装python2和python3

    哎,其实本人已经用惯了python2,听说python3的语法有很多不一样的地方,那我之前写的算法改起来岂不是日了狗了吗?所以一直没改用python3.但是谷歌的那个TensorFlow,在windo ...

  9. 华为畅玩5 (CUN-AL00) 刷入第三方twrp Recovery 及 root

    华为畅玩5 (CUN-AL00) 刷入第三方twrp Recovery  及 root 下载地址    http://pan.baidu.com/s/1hsn6VzA 1. 在官网申请解锁码    申 ...

  10. js12---闭包,原型,继承

    <html> <body> <script type="text/javascript"> //闭包实现了函数层面多个子函数共享父类函数的属性. ...