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. BZOJ 4517: [Sdoi2016]排列计数 错排 + 组合

    从 $n$ 个数中选 $m$ 个不错排,那就是说 $n-m$ 个数是错排的. 用组合数乘一下就好了. Code: #include <cstdio> #include <algori ...

  2. EF另一个 SqlParameterCollection 中已包含 SqlParameter。

    代码: SqlParameter[] commandParameters = new SqlParameter[]{ new SqlParameter("@CultID",filt ...

  3. (59)Linux操作系统深入应用

    目录: 第一部分:嵌入式的含义 第二部分:DOS命令 第三部分:linux的发展历史(与unix的关系) 第四部分: 基于ubuntu下的linux命令详解大全         第一部分:嵌入式的含义 ...

  4. php语法标识符

    php语法标识符 一.总结 一句话总结: 常用<?php //这里写代码 ?>:其它要么不常用,要么需要开配置 二.PHP四大标识符(语法环境) 参考或转自:PHP四大标识符(语法环境) ...

  5. 一个Qt线程的例子,用于说明QWaitCondition的作用

      描述可能比较麻烦,还是直接上代码吧! main.cpp #include <QApplication> #include "mainpage.h" int main ...

  6. inode节点号

    查看分区信息命令 df -Th 查看文件inode节点号 ls -i b.txt 查看系统中与b.txt 的inode节点号相同的所有文件,即硬链接 find  /  -inum  xxxx(b.tx ...

  7. 浅谈移动端设备标识码:DeviceID、IMEI、IDFA、UDID和UUID -费元星

    在公司做数据分析的时候,发现NA端有很多ID,所有来系统的理解一下,有问题大家多指出   [心路历程] 最近刚好在思考工作中统计数据所用的标识码产生的数据误差到底有多大,借此机会几番搜索资料+请教大神 ...

  8. django的url的name参数的意义及view中reverse

    Templates的链接地址都是根据urlpatterns定义的地址,拼凑成地址字符串,很难看,而且Templates里拼凑成的地址,随着页面的增加而不断增加,一旦在urlpatterns里的某个地址 ...

  9. CentOS安Elasticsearch

    工作中有需求用到es做数据分析和日志搜索的,整理记录一下安装部署过程.ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful we ...

  10. CentOS6.5 编译安装PHP5.6(apache模块)

    一.环境准备 1. 下载php源码包 # wget http://cn2.php.net/distributions/php-5.6.30.tar.gz # tar -xf php-5.6.30.ta ...