poj 1426
来源:互联网 发布:轩通大数据 编辑:程序博客网 时间:2024/06/08 03:35
宽搜
感觉这些搜索题都是重在想法,没有涉及剪枝
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<queue>using namespace std;int bfs(int n){ queue<long long>q; q.push(1); while(!q.empty()){ long long p=q.front(); if(p%n==0)return p; q.push(p*10); q.push(p*10+1); q.pop(); }}int main(){ int n; while(~scanf("%d",&n)&&n){ cout<<bfs(n)<<endl; } return 0;}
0 0
- poj 1426
- poj 1426
- POJ 1426
- POJ 1426
- poj 1426
- poj 1426
- poj 1426
- POJ 1426
- poj-1426
- poj 1426
- poj 1426
- 1426POJ
- poj 1426
- poj 1426
- poj--1426
- POJ 1426
- POJ 1426
- poj 1426
- fzu2204 7
- 12-可以编辑的表格
- Android各种资源详解 android开发教程
- 转载:Spring 4 + Quartz 集成举例
- ASP.NET MVC5 网站开发实践 - 概述
- poj 1426
- 内存管理总结
- PHP中文件读、写、删的操作(PHP中对文件和目录操作)
- <LeetCode><Easy>290 Word Pattern
- Android Studio 非常好用的几款插件,好用到爆
- $.each()与$(selector).each()区别详解
- POJ3122 Pie 二分查找
- CentOS6.7 安装Codeblocks
- font awesome 字体冲突 图标无法显示