搜索-H
来源:互联网 发布:淘宝虚拟网店怎么优化 编辑:程序博客网 时间:2024/06/05 22:40
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
26190
Sample Output
10100100100100100100111111111111111111
这道题大致的意思就是输入一个数,寻找一个能被这个数整除的数,并且只含1或0,这道题不是很难使劲深搜就行了。
下面是我的AC代码:
#include<iostream>#include<stdio.h>#include<string.h>#include<queue>using namespace std;long long mod[600001];int main(){ int n; while(~scanf("%d",&n)&&n) { int i; for(i=1;;i++) { mod[i]=mod[i/2]*10+i%2; if(mod[i]%n==0) { break; } } cout<<mod[i]<<endl; } return 0;}
阅读全文
0 0
- 搜索--H
- 搜索 H
- 搜索 H
- 搜索-H
- 搜索-H
- 搜索-H
- 搜索-H
- 搜索专题 H
- 搜索 H题
- 搜索练习题H-08
- eclipse中CTRL+H 搜索
- kuangbin 简单搜索 H题
- 全搜索的H.264编码
- 基础搜索算法题解(D-H)
- eclipse搜索使用_Ctrl+F/H
- Eclipse ,ctrl+h,搜索,拼接正则表达式
- eclipse CTRL+H默认打开文件搜索
- 【搜索入门专题1】hdu2717 H
- 嵌入式Linux系统设计--第五章:Linxu程序开发简介
- JS中URL中的特殊字符问题:escape,encodeURI,encodeURIComponent
- Linux for Ubuntu用gdebi安装deb文件
- Afnetworking设置超时时间无效
- Linux安装MySQL的两种方法 先卸载之前版本
- 搜索-H
- 关于NoSQL与SQL的区别
- 浅谈GAN生成对抗网络
- 基于物理的渲染—基于球面调和基的实时全局光照明
- Pyunit源码笔记之二 主函数import,初始化loader和流程概览
- Android Linux usb gadget configfs
- 无向带权图的邻接矩阵表示法
- spring的事物管理
- objc_setAssociatedObject的简单使用