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? ...
随机推荐
- Nginx与Lua利用fpm打成rpm包
1.下载相关软件 需要软件有:Nginx,LuaJIT,ngx_devel_kit,ngx_lua等安装文件 安装Lua或者LuaJIT都是可以的,但是出于效率的考虑,推荐安装LuaJITshell& ...
- boost库的使用
我的经验:在强调运行效率的场合:shared_ptr/weak_ptr很好用,尤其是weak_ptr这个能够判断一个对象的生命周期的玩意,可以简化和扩展很多设计.unordered系列的容器也很不错. ...
- 模板——Tarjan
#include <cstdio> #include <cstring> #include <iostream> #include <vector> u ...
- tableau 连接R语言
如何开始使用 Tableau 与 R? 对于已经熟悉 R 及其功能的用户而言,在 R 与 Tableau 之间建立连接非常简单.以 下说明适用于基于开源版 R 的新安装.其他一些方案也可能使用其他程序 ...
- phpcms 中路径问题
<table width="100%" border="0" cellspacing="0" cellpadding="0& ...
- QAbstractItemView::setRootIndex(const QModelIndex & index) 失效
问题: 在逻辑中使用了, QAbstractItemView::setRootIndex(const QModelIndex & index), 第一次设置生效, view 进入了model ...
- 用SignalR实现的共享画板例子
使用HTML5的canvas画布功能,在页面进行绘画,然后通过SignalR将画布的每个点的颜色提交到服务端,服务端同时将这些画布的信息推送到其他客户端,实现共享同一个画板的功能 类似下图,在某一个浏 ...
- java文章显示内容部分(将html转成纯文本)
public static String splitAndFilterString(String input, int length) { if (input == null || input.tri ...
- windows无法访问指定设备路径或文件。您可能没有合适的权限访问
试试退出杀毒软件试试,被杀毒软件阻拦了.
- webpack和gulp的区别
Gulp应该和Grunt比较,他们的区别我就不说了,说说用处吧.Gulp / Grunt 是一种工具,能够优化前端工作流程.比如自动刷新页面.combo.压缩css.js.编译less等等.简单来说, ...