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? ...
随机推荐
- css3样式二
1.2D转换 通过 translate() 方法,元素从其当前位置移动,根据给定的 left(x 坐标) 和 top(y 坐标) 位置参数 如:div{transform: translate(50p ...
- Codeforces Round #342 (Div. 2)-B. War of the Corporations
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- HTML 5 应用程序缓存(上)
什么是应用程序缓存(Application Cache)?HTML5 引入了应用程序缓存,这意味着 web 应用可进行缓存,并可在没有因特网连接时进行访问. 应用程序缓存为应用带来三个优势: 离线浏览 ...
- GDUFE-OJ 1203x的y次方的最后三位数 快速幂
嘿嘿今天学了快速幂也~~ Problem Description: 求x的y次方的最后三位数 . Input: 一个两位数x和一个两位数y. Output: 输出x的y次方的后三位数. Sample ...
- sendEmail报错:at /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
sendEmail发送邮件是出现以下报错: ******************************************************************* Using the ...
- python中的generator(coroutine)浅析和应用
背景知识: 在Python中一个function要运行起来,它在python VM中需要三个东西. PyCodeObject,这个保存了函数的代码 PyFunctionObject,这个代表一个虚拟机 ...
- python 学习笔记十五 web框架
python Web程序 众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. Python的WEB框架分为两类: 自己写socket,自 ...
- 查找二维数组list[][]中的最大的子数组的和
之前做过最大一维数组子数组的和的题目,现在将数组扩展成二维: 代码如下: #include<iostream> #define null -858993460 using namespac ...
- Android Studio 基本使用
一 . 目录结构: 目录结构本身代表了一个workspace空间 Android stuido是单工程的开发模式 Android stuido里面project表示工作空间,相当于eclipse里面的 ...
- UVA 11464 偶数矩阵
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...