POJ 1426 Find The Multiple
注:本人英语很渣,题目大意大多来自百度~=0=
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <cctype>
#define N 20010
#define each(i,n) (int i=1;i<=(n);++i)
using namespace std;
int a;
int dfs(long long s, int c)//c用来记录层数
{
if(c == 19) return 0;
if(s % a == 0) {
printf("%lld\n", s);
return 1;
}
else {
int b = dfs(s * 10, c + 1);
if(!b)
dfs(s * 10 + 1, c + 1);
}
}
int main()
{
while(scanf("%d", &a), a) {
dfs(1, 0);
}
}
POJ 1426 Find The Multiple的更多相关文章
- 广搜+打表 POJ 1426 Find The Multiple
POJ 1426 Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 25734 Ac ...
- POJ 1426 Find The Multiple --- BFS || DFS
POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至 ...
- POJ 1426 Find The Multiple(寻找倍数)
POJ 1426 Find The Multiple(寻找倍数) Time Limit: 1000MS Memory Limit: 65536K Description - 题目描述 Given ...
- POJ.1426 Find The Multiple (BFS)
POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个 ...
- DFS/BFS(同余模) POJ 1426 Find The Multiple
题目传送门 /* 题意:找出一个0和1组成的数字能整除n DFS:200的范围内不会爆long long,DFS水过~ */ /************************************ ...
- POJ 1426 Find The Multiple (DFS / BFS)
题目链接:id=1426">Find The Multiple 解析:直接从前往后搜.设当前数为k用long long保存,则下一个数不是k*10就是k*10+1 AC代码: /* D ...
- POJ 1426 Find The Multiple(数论——中国同余定理)
题目链接: http://poj.org/problem?id=1426 Description Given a positive integer n, write a program to find ...
- POJ 1426 - Find The Multiple - [DP][BFS]
题目链接:http://poj.org/problem?id=1426 Given a positive integer n, write a program to find out a nonzer ...
- poj 1426 Find The Multiple( bfs )
题目:http://poj.org/problem?id=1426 题意:输入一个数,输出这个数的整数 倍,且只有0和1组成 程序里写错了一个数,结果一直MLE.…… #include <ios ...
- POJ - 1426 Find The Multiple(搜索+数论)
转载自:優YoU http://user.qzone.qq.com/289065406/blog/1303946967 以下内容属于以上这位dalao http://poj.org/problem? ...
随机推荐
- NOIP 2013 货车运输 最大生成树加DFS巧妙AC
#include<set> #include<map> #include<cmath> #include<queue> #include<stac ...
- python 学习笔记十二 CSS基础(进阶篇)
1.CSS 简介 CSS 指层叠样式表 (Cascading Style Sheets) 样式定义如何显示 HTML 元素 样式通常存储在样式表中 把样式添加到 HTML 4.0 中,是为了解决内容与 ...
- tinkphp登录验证码的使用
登录和验证(控制器) <?php namespace Come\Controller; use Think\Controller; class RenController extends Con ...
- JavaScript中数组迭代方法(jquery)
var arr = [1,2,4,5,6]; //1.forEach(让数组中的每一项做一件事)arr.forEach(function(item,index){ console.log(ite ...
- Javascript运用函数计算正方形的面积
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- miniprofiler对方法的时间性能检测
miniprofiler对方法的时间性能检测 直接上代码 using StackExchange.Profiling; ... var profiler = MiniProfiler.Current; ...
- 启动tomcat部署项目时 ContainerBase.addChild: start:
严重: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component ...
- [poj2349]Arctic Network(最小生成树+贪心)
Arctic Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17758 Accepted: 5646 D ...
- cocos学习笔记:快速上手
cc.Class({ //奇怪的语法风格,cc.class, extends: cc.Component, //扩展自cc.Component properties: { //类的属性设置 jumpH ...
- c++ is_space函数
C库函数int isspace(int c)检查传递的字符是否是空白. 标准空白字符: ' ' (0x20) space (SPC) ' ' (0x09) horizontal tab (TAB) ' ...