Find The Multiple

 

Description

Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.

Input

The input file may contain multiple test cases. Each line contains a value of n (1 <= n <= 200). A line containing a zero terminates the input.

Output

For each value of n in the input print a line containing the corresponding value of m. The decimal representation of m must not contain more than 100 digits. If there are multiple solutions for a given value of n, any one of them is acceptable.

Sample Input

2
6
19
0

Sample Output

10
100100100100100100
111111111111111111

Source

 
 //2017-02-23
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int ans[], n;
bool ok; void dfs(unsigned long long num, int pos)
{
if(ok || pos == )return;
if(num%n==){
cout<<num<<endl;
ok = true;
return;
}else{
dfs(num*, pos+);
dfs(num*+, pos+);
}
} int main()
{
while(cin>>n && n)
{
ok = false;
dfs(, );
} return ;
}

POJ1426(KB1-E 暴力搜索)的更多相关文章

  1. ACM 暴力搜索题 题目整理

    UVa 129 Krypton Factor 注意输出格式,比较坑爹. 每次要进行处理去掉容易的串,统计困难串的个数. #include<iostream> #include<vec ...

  2. hdu 4740 The Donkey of Gui Zhou(暴力搜索)

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4740 [题意]: 森林里有一只驴和一只老虎,驴和老虎互相从来都没有见过,各自自己走过的地方不能走第二次 ...

  3. hdu 1427 速算24点 dfs暴力搜索

    速算24点 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem De ...

  4. 随手练——洛谷-P1151(枚举与暴力搜索)

    枚举 #include <iostream> using namespace std; int main() { ; cin >> k; ; i < ; i++) { ) ...

  5. 枚举进程——暴力搜索内存(Ring0)

    上面说过了隐藏进程,这篇博客我们就简单描述一下暴力搜索进程. 一个进程要运行,必然会加载到内存中,断链隐藏进程只是把EPROCESS从链表上摘除了,但它还是驻留在内存中的.这样我们就有了找到它的方法. ...

  6. [luogu 1092] 虫食算 (暴力搜索剪枝)

    传送门 Description Input 包含四行. 第一行有一个正整数 (N≤26). 后面的三行,每行有一个由大写字母组成的字符串,分别代表两个加数以及和.这3个字符串左右两端都没有空格,从高位 ...

  7. HDU 3131 One…Two…Five! (暴力搜索)

    题目链接:pid=3131">HDU 3131 One-Two-Five! (暴力搜索) 题意:给出一串数字,要求用加,减,乘,除(5/2=2)连接(计算无优先级:5+3*6=8*6= ...

  8. 吴裕雄 python 机器学习——模型选择参数优化暴力搜索寻优GridSearchCV模型

    import scipy from sklearn.datasets import load_digits from sklearn.metrics import classification_rep ...

  9. POJ 1129:Channel Allocation 四色定理+暴力搜索

    Channel Allocation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13357   Accepted: 68 ...

  10. 「状压DP」「暴力搜索」排列perm

    「状压DP」「暴力搜索」排列 题目描述: 题目描述 给一个数字串 s 和正整数 d, 统计 sss 有多少种不同的排列能被 d 整除(可以有前导 0).例如 123434 有 90 种排列能被 2 整 ...

随机推荐

  1. python爬虫的页面数据解析和提取/xpath/bs4/jsonpath/正则(2)

    上半部分内容链接 : https://www.cnblogs.com/lowmanisbusy/p/9069330.html 四.json和jsonpath的使用 JSON(JavaScript Ob ...

  2. webpack快速入门——CSS进阶,Less文件的打包和分离

    1.要使用less,首先使用npm安装less服务 cnpm install less --save-dev 还需要安装Less-loader用来打包使用. cnpm install less-loa ...

  3. CAN总线协议 学习笔记

    1.CAN总线网络 CAN总线网络主要挂在CAN_H和CAN_L,各个节点通过这两条线实现信号的串行差分传输,为了避免信号的反射和干扰,还需要在CAN_H和CAN_L之间接上120欧姆的终端电阻,但是 ...

  4. 组件基础—Vue学习笔记

    ammm学习Vue有好几天了,今天遇到难点所以打算写一点随笔加深印象. 一.首先最简单的创建组件 1全局组件   Vue.component() Vue.component('hello',{ tem ...

  5. linux下redis安装步骤

    1.官网上下载redis最新包,我下载的是redis-5.0.3.tar.gz,上传至服务器 2.解压缩:tar zxvf redis-5.0.3.tar.gz3.cd redis-5.0.3进入re ...

  6. 【xsy1197】 树 二分+点分树+二分

    题目大意:给你一棵$n$个点的带权树和正整数$K$,求每个点到其它所有点距离中第$K$大的数值. 其中,边权$≤10000$,$n≤50000$. 我们通过原树构建一棵点分治树,令$fa[u]$为$u ...

  7. Excel中复杂跨行跨列数据

    XSSFWorkbook wb = new XSSFWorkbook(); // 工作表 XSSFSheet sheet = wb.createSheet("车辆使用情况统计"); ...

  8. vue、react、angular三大框架对比 && 与jQuery的对比

    前端当前最火的三大框架当属vue.react以及angular了. 但是在做项目的时候,我们怎么去选择呢?  这里做一个比较,希望大家可以有一个比较清晰的认识. vue与react vue和react ...

  9. vue-devtools必备工具

    1.github下载地址:https://github.com/vuejs/vue-devtools 2.下载安成之后打开cmd进入vue-devtools文件夹把依赖装好npm install 之后 ...

  10. jython实现java运行python代码

    Jython是一种完整的语言,而不是一个Java翻译器或仅仅是一个Python编译器,它是一个Python语言在Java中的完全实现.最近的一个项目需要将python代码转换成java实现,所以用了一 ...