POJ 1426 Find The Multiple
来源:互联网 发布:淘宝卖家诈骗800 编辑:程序博客网 时间:2024/06/05 20:31
http://poj.org/problem?id=1426
Find The Multiple
Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 19337Accepted: 7845Special Judge
Description
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.
Input
The input file may contain multiple test cases. Each line contains a value of n (1 <= n <= 200). A line containing a zero terminates the input.
Output
For each value of n in the input print a line containing the corresponding value of m. The decimal representation of m must not contain more than 100 digits. If there are multiple solutions for a given value of n, any one of them is acceptable.
Sample Input
26190
Sample Output
10100100100100100100111111111111111111
Source
Dhaka 2002
竟然没有超long long#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#include <stack>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b)
{
return a>b;
}
int n;
void bfs()
{
queue<ll>q;
q.push(1);
while(!q.empty())
{
ll k=q.front();q.pop();
if(k%n==0)
{
printf("%I64d\n",k);break;
}
q.push(k*10);
q.push(k*10+1);
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
while(scanf("%d",&n)!=EOF)
{
if(n==0)break;
bfs();
}
return 0;
}
0 0
- poj 1426 Find The Multiple
- Poj 1426 Find The Multiple
- POJ 1426 Find the Multiple
- poj 1426Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- poj - 1426 - Find The Multiple
- POJ 1426 Find The Multiple
- POJ-1426-Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- poj 1426 Find The Multiple
- POJ 1426 Find The Multiple
- Codeforces Round #293 (Div. 2)
- Codeforces Round #292 (Div. 2)
- IOS中NSUserDefaults的用法
- Codeforces Round #291 (Div. 2)
- HDU 2181 哈密顿绕行世界问题
- POJ 1426 Find The Multiple
- POJ 3984 迷宫问题
- HDU 2612 Find a way
- 字典树(trie 树)
- intellij idea15 破解
- UVa 11732 - strcmp() Anyone?
- POJ 3630 Phone List
- HDU 1251 统计难题
- 报名|「OneAPM x DaoCloud」技术公开课:Docker性能监控!
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
大卫艾克
早早孕大卫
大卫公司
大卫科波菲尔
大卫科波菲尔读后感
大卫排卵试纸8档图解图
陈男模大卫厕玩鸟
大卫科波菲尔读书笔记
大卫排卵试纸
大卫不可以绘本
大卫科波菲尔摘抄
大卫科波菲尔简介
大卫上学去绘本故事
大卫柯南伯格
大卫验孕棒多久能测出来
大卫雕塑的睾丸
大卫斯托克顿
大卫不可以教案
玛嘉烈与大卫
大卫斯特恩中国事件
陈男模大卫厕所玩鸟海洋
大卫色度值从8到1说明
大卫早早孕试纸图解
大卫鲍森新约圣经纵览
大卫英文怎么写
大卫是谁的作品
米开朗基罗大卫
大卫雕塑赏析
大卫雕塑图片
大卫罗宾逊邓肯
大卫早早孕弱阳
大卫验孕棒准吗
大卫早早孕检测试盒
大卫排卵试纸准确吗
大卫早早孕检测试笔
大卫早孕试纸准确率
大卫 科波菲尔
大卫试纸准吗
大卫试纸一深一浅
米开朗琪罗大卫
大卫科波菲尔 董秋斯