POJ Find The Multiple 1426 (搜索)
Time Limit: 1000MS | Memory Limit: 10000K | |||
Total Submissions: 22576 | Accepted: 9291 | Special Judge |
Description
Input
Output
Sample Input
- 2
- 6
- 19
- 0
Sample Output
- 10
- 100100100100100100
- 111111111111111111
题目大意:找到n的一个倍数,并且这个数只由0 1组成。
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- int n;
- bool flag;
- unsigned long long m;
- void dfs(unsigned long long x,int k)
- {
- cout<<x<<endl;
- if(flag)
- return;
- if(x%n==)
- {
- flag=;
- m=x;
- return;
- }
- if(k==)
- return;
- dfs(x*,++k);
- dfs(x*+,k);
- return;
- }
- int main()
- {
- int i,j;
- while(cin>>n&&n)
- {
- flag=;
- dfs(,);
- cout<<m<<endl;
- }
- }
POJ Find The Multiple 1426 (搜索)的更多相关文章
- POJ - 1426 Find The Multiple(搜索+数论)
转载自:優YoU http://user.qzone.qq.com/289065406/blog/1303946967 以下内容属于以上这位dalao http://poj.org/problem? ...
- POJ 3126 Prime Path 广度优先搜索 难度:0
http://poj.org/problem?id=3126 搜索的时候注意 1:首位不能有0 2:可以暂时有没有出现在目标数中的数字 #include <cstdio> #include ...
- [POJ]Find The Multiple(DFS)
题目链接 http://poj.org/problem?id=1426 题意 输入一个数n,输出任意一个 只含0.1且能被n整除的数m.保证n<=200,m最多100位. 题解 DFS/BFS都 ...
- poj 1426 Find The Multiple (bfs 搜索)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18012 Accepted: 729 ...
- POJ1426-Find The Multiple(搜索)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 42035 Accepted: 176 ...
- POJ 1088 滑雪 (记忆化搜索)
题目链接:http://poj.org/problem?id=1088 题意很好懂,就是让你求一个最长下降路线的长度. dp[i][j]记录的是i j这个位置的最优的长度,然后转移方程是dp[i][j ...
- POJ 1321 棋盘问题 DFS搜索
简单搜索 练习一下回溯 #include <iostream> #include <cstdio> #include <cstring> #include < ...
- POJ 1321 棋盘问题(搜索的方式)
Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子 ...
- POJ 1390 Blocks(记忆化搜索+dp)
POJ 1390 Blocks 砌块 时限:5000 MS 内存限制:65536K 提交材料共计: 6204 接受: 2563 描述 你们中的一些人可能玩过一个叫做“积木”的游戏.一行有n个块 ...
随机推荐
- 使用git pull时,项目没有更新?
进入项目目录后,执行 git pull 命令,没有将项目更新,并提示下图: 提示:there is no tracking information for the current branch. 意思 ...
- 【转】用Device tree overlay掌控Beaglebone Black的硬件资源
原文网址:https://techfantastic.wordpress.com/2013/11/15/beaglebone-black-device-tree-overlay/ 经过一晚上的Goog ...
- 使用WCF实现SOA面向服务编程—— 架构设计
原文地址:http://www.cnblogs.com/leslies2/archive/2011/03/29/1997889.html SOA本身就是一种面向企业级服务的系统架构,简单来说,SOA就 ...
- [转]ReactJS入门教程
Refference From:http://www.cocoachina.com/webapp/20150721/12692.html 现在最热门的前端框架有AngularJS.React.Boot ...
- poj2787 算24
每次枚举两个数,一个运算符,得到一个运算结果.在重复执行,直到只剩下一个数即可. #include <iostream> #include <cmath> using name ...
- POI导入数据
package util; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.I ...
- 判断一个int 型整数 是否为回文数
leetcode 上的题目 Determine whether an integer is a palindrome. Do this without extra space. 由于不能使用额外空间, ...
- Codeforces 549F Yura and Developers
probelm 题意 给定一个序列和一个mod值,定义[l,r]合法当l到r的全部元素和减去当中的最大值的结果能够整除mod.问共同拥有多少区间合法. 思路 一開始想的分治. 对于一个[l,r]我们能 ...
- (2)入门指南——(3)为什么jquery工作的很好(Why jQuery works well)
With the resurgence of interest in dynamic HTML comes a proliferation of JavaScript frameworks. Some ...
- 自定义上传按钮 <input type="file" name = "file"/> (将file隐藏在button下)
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...