POJ 1426 Find The Multiple (dfs)

详解最大似然估计(MLE)、最大后验概率估计(MAP),以及贝叶斯公式的理解 声明:本文为原创文章,发表于nebulaf91的csdn博客。欢迎转载,但请务必保留本信息,注明文章出处。 本文作者: nebulaf91 本文原始地址:最大似然估计(Maximum likelihood estimation, 简称MLE)和最大后验概率估计(Maximum a posteriori estimation, 简称MAP)是很常用的两种参数估计方法,如果不理解这两种方法的思路,很 阅读详情

                                                       Find The Multiple
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 22773 Accepted: 9387 Special 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

2
6
19
0

Sample Output

10
100100100100100100
111111111111111111

题目链接:http://poj.org/problem?id=1426

题目大意:给一个数字n,求出它的每位只由0和1组成的倍数。

解题思路:因为n的大小不超过200,所以满足条件的倍数在long long 范围内,直接深搜。

代码如下:


#include <cstdio>
#include <cstring>
#define ll long long 
ll n;
bool p;
int m;
void dfs(ll x,int cnt)
{
    if(x%n==0)   //找到答案,返回
    {
        p=true;
        printf("%I64d\n",x);
        return ;
    }
    if(cnt>=18)         //在long long 的范围内,超过这个范围直接返回 
        return ;
    for(int i=0;i<=1;i++)   //枚举下一位数字是0或者1
    {
        dfs(x*10+i,cnt+1);
        if(p)
            return ;
    }
}
int main(void)
{
    while(scanf("%I64d",&n)!=EOF&&n)
    {
        m=0,p=false;
        dfs(1,0);
    }
}


37、半导体硅材料中的缺陷与吸杂技术解析 本文系统解析了半导体硅材料中的缺陷形成机制及其对电子器件性能的影响,重点探讨了生长和工艺诱导缺陷、表面与内部微缺陷的起源与特征。文章详细阐述了吸杂技术的原理、过程及在集成电路和太阳能电池制造中的应用,强调通过氧行为调控和热处理优化实现缺陷控制。同时介绍了吸杂效果的评估方法,并展望了未来新型吸杂技术的发展趋势,为提升半导体器件性能和制造良率提供理论支持和技术路径。 阅读详情

相关推荐

详细介绍pytorch重要的API

Tensor 是 PyTorch 中最基本的数据结构,提供了多种创建和操作张量的函数。Autograd 提供了自动求导功能,可以跟踪 Tensor 上的操作并计算梯度。损失函数用于衡量模型预测值与真实值之间的差异,提供了多种损失函数。是构建神经网络的基础类,提供了定义网络层和前向传播的方法。提供了 GPU 计算的支持,包括设备管理、内存管理等。提供了一些常用的函数式操作,如激活函数、损失函数等。提供了常用的数据集、模型架构和图像转换工具。提供了数据加载和预处理的工具,包括。

hello! 1223

POJ 1426 Find The Multiple 简单dfs构造

POJ 1426 Find The Multiple 简单dfs构造题意大概意思题解 链接: 原题网站. 题意 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

zkpj12的博客 262

从零构建SOEM主站:基于STM32的EtherCAT伺服控制实战指南

本文详细介绍了如何从零构建基于STM32的SOEM主站系统,实现EtherCAT伺服电机的高精度控制。通过硬件选型、SOEM协议栈移植、PDO/SDO配置优化等实战步骤,帮助开发者掌握工业自动化中的关键运动控制技术,特别适用于23位编码器伺服电机的应用场景。

weixin_29186249的博客 664

POJ1426 Find The Multiple

POJ1426 Find The Multiple题目描述 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

退役的铜牌狗 368

【机器学习】实验3,贝叶斯垃圾邮件识别(完整代码实现+报告)

电子邮件是互联网的一项重要服务,在大家的学习、工作和生活中会广泛使用。但是大家的邮箱常常被各种各样的垃圾邮件填充了。有统计显示,每天互联网上产生的垃圾邮件有几百亿近千亿的量级。因此,对电子邮件服务提供商来说,垃圾邮件过滤是一项重要功能。而朴素贝叶斯算法在垃圾邮件识别任务上一直表现非常好,至今仍然有很多系统在使用朴素贝叶斯算法作为基本的垃圾邮件识别算法。本次实验数据集来自的中文垃圾邮件数据集,目录解压后包含三个文件夹,其中data目录下是所有的邮件(未分词),已分词好的邮件在data_cut目录下。

高丽大学人工智能硕士在读|专注大模型、RAG、OCR与AI工程实践 5025

关于STM32编译报错:Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f10x_md.o).

今天新建工程发现出现一个错误 —— …\Output\CG.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f10x_md.o). 但我觉得我的操作没有任何问题,而且配置和上一个文件比较是一模一样的。 于是我开始百度查询,然后发现了下面几个博客—— @weixin_44133391——STM32 编译错误 @dorlolok——iel5 编译报错 error: L6235E: More than one

纯粹,学术,热爱。 9401

POJ 1426 Find The Multiple【dfs】

Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22877 Accepted: 9431 Special Judge Description Given a positiveinteger n, wr

Fighting! 1668

QTableView实现表格加载百万条数据

本文介绍用QTableView实现加载100万条数据显示到表格。 1.创建工程 用Qt Creator创建Qt Widgets Application项目,基类选择QWidget,创建好了,如图: 2.添加QTableView控件 在widget.ui中添加QTableView控件,和QPushButton,采用栅格布局,如图: 3.添加函数 头文件 QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACE class Wid

丁爸的博客 8269

【POJ 1426 --- Find The Multiple】取余+DFS

【POJ 1426 --- Find The Multiple】取余+DFS 题目来源:点击进入【POJ 1426 — Find The Multiple】 Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representatio...

来日浅谈的博客 383

q-learning精讲

Q-learning Q-learning是一种用于机器学习的强化学习技术。 Q-learning的目标是学习一种策略,告诉Agent在什么情况下要采取什么行动。 它不需要环境模型,可以处理随机转换和奖励的问题,而无需进行调整。 对于任何有限马尔可夫决策过程(FMDP),Q学习找到一种最优的策略,即从当前状态开始,它在任何和所有后续步骤中最大化总奖励的预期值。在给定无限探索时间和部分随机策略的情况...

weixin_41697507的博客 1万+

【智能车Code review】——拐点的寻找

CROSSROAD:十字拐点 ROUNDISLAND:环岛拐点 rightfindflag[i]:表示第i行的右线是否被找到,1为找到,0为没有找到 flag_find_huan_rightdown_point :找到环岛右下拐点标志 flag_find_huan_rightmiddle_point:找到环岛右中拐点标志 找拐点的思路:观察一段数据中数据点的走向趋势,并且保证这段数据是准确的。在摄像头畸变比较严重的情况下这种方法不再适用 关于函数的调用请见:https://blog.youkuaiyun.com/qq.

hanhan的博客 1万+

POJ - 1426 Find The Multiple 【DFS】

题目链接 http://poj.org/problem?id=1426 题意 给出一个数 要求找出 只有 0 和 1 组成的 十进制数字 能够整除 n n 不超过 200 十进制数字位数 不超过100 思路 其实 十进制数字位数 不超过 20 下就有可以满足的答案 所以直接用 unsinged long long 就可以过了 。...

dianxi0949的博客 71

在blender中安装vtk插件

Blender 是一个开源的、功能强大的3D计算机图形软件,广泛用于创建动画片、视觉效果、艺术作品、3D打印模型、互动3D应用程序和视频游戏。Blender 是由 Blender 基金会开发和维护的,具有丰富的功能和灵活的扩展性。在github上下载zip插件。

如果想成为中心,那么就到中心去吧。 292

Find The Multiple/POJ 1426/DFS

Find The Multiple/POJ 1426/DFS 题目 给定一个正整数n,请编写一个程序来寻找n的一个非零的倍数m,这个m应当在十进制表示时每一位上只包含0或者1。你可以假定n不大于200且m不多于100位。 题目来源:POJ 1426 题目链接 解法 虽然题目说是m不多于100位,但其实20位就足够了,所以我们直接用DFS暴搜来枚举m即可。 代码: #include <st...

weixin_45600829的博客 168

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

POJ 1426 Find The Multiple ——————DFS

Find The Multiple Language:DefaultFind The Multiple Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 42225Accepted: 17735Special JudgeDescriptionGiven a positive integer n, write a program ...

鸿杰 的博客 259

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

POJ1426 Find The Multiple DFS

Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 46265 Accepted: 19320 Special Judge Description Given a positive integer n, write a program to find out a nonzero multip...

DouglasConnor的博客 236

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

【ACM】【DFS】POJ 1426 Find The Multiple

Find The Multiple 点我前往题目链接 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 47745 Accepted: 19938 Special Judge Description Given a positive integer n, write a...

lesileqin的博客 274

POJ1426 Find The Multiple (DFS)

                                     E - Find The Multiple POJ - 1426Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the di...

Xuedan_blog的博客 275

Poj 1426 Find The Multiple 【DFS】

Find The MultipleTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 19815 Accepted: 8048 Special Judge DescriptionGiven a positive integer n, write a program to find out a nonzero multiple

shengweisong 772

poj 1426 Find The Multiple(dfs || 二进制枚举)

题目:http://poj.org/problem?id=1426 大意是:给定一个数字n,求出数字m,其中m是n的倍数,且m是只由0,1构成的十进制数。 Sample Input 2 6 19 0 Sample Output 10 100100100100100100 111111111111111111 经典的深搜,开始我一直往数论方向想呢···使用单纯的枚举肯定是要超时的

theArcticOcean 1020

POJ - 1426(Find The Multiple)DFS

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 2...

Zoran的博客 206

POJ - 1426 - Find The Multiple (DFS)

题目传送:Find The Multiple 思路:DFS AC代码: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define LL lo

Never say never 941

DFS POJ - 1426 Find The Multiple

Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 29571 Accepted: 12286 Special Judge Description Given a positive integer n, write a

PiKa__Qiu的博客 291

POJ-1426(Find The Multiple) dfs

POJ-1426 #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;cstring&gt; using namespace std; typedef unsigned long long ull; int visit; void dfs(ull n, int m, int k) { if(visit) ret...

YancyKahn 356

POJ - 1426 Find The Multiple (DFS)

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...

洛 水 145

POJ - 1426 Find The Multiple (dfs)

题目:Find The Multiple 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 grea...

Sky丨Star的博客 194
上一篇: Codeforces Round #321 (Div. 2) C. Kefa and Park time limit per test
下一篇: POJ 3126 Prime Path (BFS)
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值