PKU1426 Find The Multiple (memory limit超过了。。。。)
来源:互联网 发布:网络部门岗位职责 编辑:程序博客网 时间:2024/04/30 00:20
#include <iostream>
#include <queue>
using namespace std;
void bfs(int number,queue<long long> m)
{
if(m.front() % number == 0)
{
cout<<m.front()<<endl;
return;
}
else
{
m.push(m.front() * 10);
m.push(m.front() * 10 + 1);
m.pop();
bfs(number,m);
}
return;
}
int main(void)
{
int number;
while(cin>>number)
{
if(number == 0)
{
break;
}
else
{
queue<long long> m;
m.push(1);
bfs(number,m);
}
}
return 0;
}
内存太大 不过做完这个题目对广搜和与深搜的对比清晰了不少。。可惜自己水平太差。。。不知道那些20K 0MS的大牛们都怎么过的阿。。。。。。。。。。
- PKU1426 Find The Multiple (memory limit超过了。。。。)
- Find The Multiple(dfs)
- Find The Multiple (BFS)
- Find The Multiple(搜索)
- Find The Multiple (深搜(。。。水))
- POJ1426:Find The Multiple(BFS)
- Find The Multiple(POJ 1426)
- POJ 1426 Find The Multiple (DFS)
- POJ - 1426 - Find The Multiple (DFS)
- C - Find The Multiple(BFS)
- POJ 1426 Find The Multiple(dfs)
- poj1426 Find The Multiple(哈夫曼思想)
- POJ 1426 Find The Multiple(dfs)
- POJ1426 Find The Multiple(BFS)
- POJ 1426 Find The Multiple(dfs)
- POJ 1426 Find The Multiple (bfs)
- poj 1426 Find The Multiple(搜索)
- poj 1426 Find The Multiple(DFS)
- gridview 导出excel 总结
- 在JS中访问JSP Request中的变量
- parentNode、parentElement,childNodes、children 区别
- CnComm勘误及Faq
- 查询不重复数据
- PKU1426 Find The Multiple (memory limit超过了。。。。)
- 深入学习科学发展观
- 双目视觉简单测试
- Java多态实例
- 用例文档
- 捕捉WebBrowser页面的滚动条滚动事件
- 搜索引擎算法研究
- 大港电厂实习报告
- jpa遇到的 org.hibernate.PersistentObjectException: detached entity passed to persist异常