POJ
来源:互联网 发布:python 数据缺失 编辑:程序博客网 时间:2024/06/01 08:33
题意:就是只有1和0组成的一个数,能整除N.
因为答案不唯一,所以可以暴力的用BFS求出来很简单。
#include <iostream>#include <queue>#include <cstdio>using namespace std;typedef unsigned long long ull;void bfs(ull n){ queue< ull> q; q.push(1); while(!q.empty()) { ull s = q.front(); q.pop(); if(s % n == 0) { cout << s << endl; return; } q.push(s * 10); q.push(s * 10 +1); } return ;}int main(){ ull n; while(cin >> n && n) { bfs(n); } return 0;}
0 0
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- Java小程序:将json文件中树信息转换成insert sql脚本
- 暴力破解Zip 文件
- Codeforces 798D Mike and distribution(二维贪心)
- struts2中getOutputStream() has already been called for
- 安全认证框架Shiro (一)- ini配置文件
- POJ
- python-opencv-轮廓检测
- SpringBoot非官方教程 | 第三篇:SpringBoot用JdbcTemplates访问Mysql
- 数据语句
- AngularJs学习笔记(1)--简介和数据绑定
- 合并排序的递归算法
- 浏览器渲染引擎
- 推荐系统之协同过滤(CF)算法
- 2017算法课.09(Is Subsequence)