poj解题报告——1426
来源:互联网 发布:木马源码 编辑:程序博客网 时间:2024/06/10 10:33
题目大意,给出一个整数n,(1 <= n <= 200)。求出任意一个它的倍数m,要求m必须只由十进制的'0'或'1'组成。
代码如下
#include<stdio.h>
#define N 200
#define M 100
int n;
__int64 que[9999999];
void bfs()
{
__int64 now;
int head=1,tail=1;
que[tail++]=1;
while(head<tail)
{
now=que[head++];
if(now%n==0)
{
printf("%I64d\n",now);
return;
}
que[tail++]=now*10;
que[tail++]=now*10+1;
}
}
void main()
{
while(scanf("%d",&n),n!=0)
{
bfs();
}
}
0 0
- poj解题报告——1426
- POJ 1426 解题报告
- POJ 1088 滑雪——解题报告
- POJ 1047——解题报告
- poj解题报告——poj1006
- poj解题报告——1032
- poj解题报告——1061
- poj解题报告——1450
- poj解题报告——1002
- poj解题报告——2109
- poj解题报告——1218
- poj解题报告——1250
- poj解题报告——1012
- poj解题报告——3299
- poj解题报告——2209
- poj解题报告——2406
- poj解题报告——2242
- poj解题报告——1401
- 51单片机资源扩展:从片内ROM跳转到片外ROM
- JQuery实现数据格式化
- Copy List with Random Pointer的解题报告
- JS中的call()和apply()方法
- Microsoft Office 2007 无法正常卸载怎么办?
- poj解题报告——1426
- Java多线程-工具篇-BlockingQueue
- JS日期(Date)处理函数总结
- POJ 题目2406 Power Strings(KMP)
- 计算机网络笔记《一》
- base64那点事
- Process 的 waitFor() 造成的阻塞
- 对编写爬虫的巩固
- 计算机网络《二》