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

【题意】

在这里输入题意

【题解】

枚举分母从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. Ubuntu系统下的多路径软件 DM Multipath 配置。

    Ubuntu系统下的多路径软件是操作系统自带的 DM Multipath工具.------------------------------------------------------------- ...

  2. vim7.4官方源码在vs2013的编译方法及问题总结

    vim7.4发布也有一段时候了,也该是把之前编译的7.3重新编译一下了,于是考虑着到最新的visual studio 2013编译一下,也顺便看看有没有其它问题. 1.安装vs2013,这个应该不用说 ...

  3. CentOS下安装.net core环境并部署WebAPI

    1.安装CentOS 7 2.安装.net Core 2环境,参考官方文档:(建议采用SDK (tar.gz)安装) https://www.microsoft.com/net/download/li ...

  4. BZOJ——1012: [JSOI2008]最大数maxnumber || 洛谷—— P1198 [JSOI2008]最大数

    http://www.lydsy.com/JudgeOnline/problem.php?id=1012|| https://www.luogu.org/problem/show?pid=1198 T ...

  5. [Python] Slicing Lists

    In addition to accessing individual elements from a list we can use Python's slicing notation to acc ...

  6. 搭建 GIT 服务器教程

  7. css3.0滚动条的优化

    .ass_showFriends{width: 93%;height: 8.35rem;overflow-y: auto;} .ass_showFriends::-webkit-scrollbar{w ...

  8. ATcoderARC100D Equal Cut

    ARC100 D - Equal Cut Description: 给出长度为n的序列A,把这个序列分成连续的四段,最小化极差. \(4≤n≤2×10^5,4≤n≤2×10^5\) Solution: ...

  9. Ansible学习记录一:Linux下部署

    0.Ansible介绍 Ansible 是一个简单的自动化运维管理工具,可以用来自动化部署应用.配置.编排 task(持续交付.无宕机更新等),采用 paramiko 协议库(fabric 也使用这个 ...

  10. 使用maven的tomcat:run进行web项目热部署

    近期又又一次看了一下maven的东西,事实上主要是由于去了解Jenkins,后期或许会补充jenkins的博文. 怎么在eclipse里面创建maven webproject,这边就不介绍了,參见:h ...