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
#include<stdio.h>

bool vis;

void dfs( unsigned __int64 sum,int n,int k)
{
if (vis)return ;
if(sum%n==)
{
printf("%I64u\n",sum);
vis=;
return ;
}
if(k==) return;
dfs(sum*,n,k+);
dfs(sum*+,n,k+); } int main()
{
int n;
while(scanf("%d",&n)!=EOF&&n!=){ vis=;
dfs(,n,);
}
return ;
}

2018-11-29

Find The Multiple (水题)的更多相关文章

  1. CF451B Sort the Array 水题

    Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...

  2. hdu 1005:Number Sequence(水题)

    Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  3. HDU 4950 Monster (水题)

    Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...

  4. HDU 4593 H - Robot 水题

    H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  5. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  6. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

  7. hdu5360 Hiking(水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Hiking Time Limit: 6000/3000 MS (Java/Oth ...

  8. BestCoder Round #36 (hdu5199)Gunner(水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Gunner Time Limit: 8000/4000 MS (Java/Oth ...

  9. <hdu - 3999> The order of a Tree 水题 之 二叉搜索的数的先序输出

    这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999  Problem Description: As we know,the sha ...

  10. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

随机推荐

  1. mysql MAX()函数 语法

    mysql MAX()函数 语法 作用:返回一列中的最大值.NULL 值不包括在计算中.直线电机模组--BZD80N 语法:SELECT MAX(column_name) FROM table_nam ...

  2. 设置获取data-*属性值

    html代码如下: <div id="getId" data-id="122" data-vice-id="11">获取id&l ...

  3. 【BZOJ3894】 文理分科

    Description  文理分科是一件很纠结的事情!(虽然看到这个题目的人肯定都没有纠 结过)  小P所在的班级要进行文理分科.他的班级可以用一个n*m的矩阵进行 描述,每个格子代表一个同学的座位. ...

  4. [BZOJ2839]:集合计数(组合数学+容斥)

    题目传送门 题目描述 .(是质数喔~) 输入格式 一行两个整数N,K. 输出格式 一行为答案. 样例 样例输入: 3 2 样例输出: 样例说明 假设原集合为{A,B,C} 则满足条件的方案为:{AB, ...

  5. Floating Point Math

    Floating Point Math Your language isn't broken, it's doing floating point math. Computers can only n ...

  6. SQL Server database mail问题诊断一例

    产品环境sql server database的mail发不出邮件,影响客户的业务,在数据库中进行诊断 诊断sql: EXEC msdb.dbo.sp_send_dbmail @profile_nam ...

  7. 在linux下搭建go环境

    这几天小Jerry开始接触Go语言了,因为小Jerry学个东西必须要从最基础的开始弄懂,不然~她理解不了<hahaha> 所以,今天就来讲最基础,却也很容易让小Jerry这样的菜鸟感到困扰 ...

  8. install_github无法安装 Rwebdriver包的解决方法

    1.通过install_githtb安装Rwebdriver包的错误如下: 提示不能打开URL,但是将URL地址输入浏览器地址栏,则可以下载包到本地 2.在网上搜索,发现可以通过本地文件来安装(ins ...

  9. Python的复制,浅拷贝和深拷贝

    https://www.cnblogs.com/xueli/p/4952063.html 如果给一个变量赋值一个对象,那么新变量和原对象变量将会是同一个引用,其中一方改变,另一方也会改变. 该问题可以 ...

  10. leetcode-easy-array-48. Rotate Image-NO

    mycode 思路:第m行要变到 - 1- m 列 ,但是没有再想一步即列变为行,这样每一个位置的变换方式就出来了 难点:如何不使用额外空间呢? 参考: 思路:找到矩阵旋转和转置之间的联系,转置是可以 ...