POJ 1426
来源:互联网 发布:剑三花姐捏脸数据截图 编辑:程序博客网 时间:2024/06/07 23:55
一道BFS题。要从数据的构成考虑
#include <cstdio>#include <iostream>#include <queue>using namespace std;typedef long long LL;void bfs(int n){ queue<LL> q; q.push(1); while(!q.empty()){ if(q.front()%n==0){printf("%lld\n",q.front());return;} LL top = q.front(); q.pop(); q.push(top*10); q.push(top*10+1); }}int main(){ int n; while(~scanf("%d",&n)&&n){ bfs(n); }}
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
- 友盟用户分析
- android-java调试-如何增强jdb调试功能
- Count and Say
- ReentrantLock与synchronized在与数据库交互时的问题
- Unix下的进程管理
- POJ 1426
- 开等问题
- 4 硬件
- PHP-Mmecache操作类详细介绍
- delphi导入导出excel|oracle
- [LeetCode] 11. Container With Most Water
- Java 中Instanceof的用法
- 杭电ACM 1008
- GitHub for Windows 安装失败,An error occurred attempting to install github 的解决办法