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

运行codex时出现登录失败:failed to start login server: 以一种访问权限不允许的方式做了一个访问套接字的尝试。 (os error 10013) 解决方案 本文主要介绍了运行codex时出现登录失败:failed to start login server: 以一种访问权限不允许的方式做了一个访问套接字的尝试。 (os error 10013) 解决方案,希望能对使用xx的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案 阅读详情

Find The Multiple

Language:Default
Find The Multiple
Time Limit: 1000MSMemory Limit: 10000K
Total Submissions: 42225Accepted: 17735Special 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

Source

—– 这道题让找 n 的 01 十进制倍数, 也就是说,找出一个01序列,它是 n 的倍数 第一位只能是1 所以就从 1 开始DFS 下一位只能是0或者1 所以说复杂度是 O(2n) O ( 2 n ) 的级别,有点儿不敢写,但是后来发现这个最大也就是 218 2 18 ,能过得 —
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,k,flag;
void dfs(ll t,ll i)
{
    if(i==19)    return ;
    if(flag)    return ;
    if(t%n==0)
    {
        flag=1;
        printf("%lld\n",t);
        return ;
    }

    dfs(t*10,i+1);
    dfs(t*10+1,i+1);
}
int main()
{
    while(~scanf("%lld",&n)&&n)
    {
        flag=0;
        dfs(1,0);
    }
    return 0;
}

使用pyqt5实现可勾选的测试用例界面 阅读详情

相关推荐

卷积神经网络-猫狗识别(附源码)

利用python实现一个卷积神经网络,训练猫狗数据集,实现对猫狗图片的预测识别

m0_63223213的博客 2万+

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

weixin_43965698的博客 332

CLion与STM32CubeMX联调:JLink GDB Server高效调试指南

本文详细介绍了如何搭建并配置CLion、STM32CubeMX与JLink GDB Server联调的现代化STM32开发环境。通过一站式环境搭建、工程创建、核心调试配置及高级技巧(如RTT日志),该组合实现了高效的代码编辑、可视化配置与稳定调试,大幅提升嵌入式开发效率与体验。

web99的专栏 258

poj解题报告——1426

题目大意,给出一个整数n,(1 代码如下 #include #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     {   

Lingfu74的专栏 517

UE5垃圾回收优化实战:定位GC卡顿与内存泄漏

垃圾回收(GC)是Unreal Engine 5中保障UObject内存安全的核心机制,其基于引用图的标记-清除原理决定了性能高度依赖引用结构合理性。当GC频繁触发或单次耗时突增,往往映射出蓝图强引用冗余、C++根对象管理失控或资源生命周期设计缺陷等底层问题。技术价值在于降低主线程阻塞、稳定60帧体验、抑制内存异常增长;典型应用场景包括关卡切换卡顿、UI打开后持续GC、打包后内存不释放等。本文聚焦UE5特有的Full GC模式、UObject生命周期约束及GC触发时机不可见性,提供从蓝图变量规范、TSoft

weixin_31995251的博客 362

Labelme AI-Polygon闪退排查与修复指南

本文详细介绍了Labelme AI-Polygon功能闪退问题的排查与修复方法,包括环境配置检查、模型路径设置、依赖库版本控制等关键步骤。通过系统性的解决方案和实用技巧,帮助用户快速解决闪退问题,确保数据标注工作的高效进行。

weixin_29311017的博客 140

[POJ - 1426 ]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 greater than 200 and...

lznext的编程日记 501

从零到一:在K210上实现YOLO模型在线训练与部署全流程

本文详细介绍了在K210芯片上实现YOLO模型在线训练与部署的全流程,涵盖数据采集、模型优化、量化转换及内存管理等关键环节。通过实战案例和代码示例,帮助开发者高效利用K210的超低功耗特性与YOLO模型的实时检测能力,适用于边缘计算和物联网应用场景。

weixin_29094539的博客 350

DFS-POJ-1426-Find The Multiple

Find The Multiple Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uDescription Given a positive integer n, write a program to find out a nonzero multiple m of n whose decim

懒鬼的私人泳池 566

SpringBoot+Vue+kkFileView实现文档管理(文档上传、下载、在线预览)

上面在使用OpenOffice实现doc、excel、ppt等文档的管理和预览。除此之外可用kkFileView实现包括且更多文档的预览。

BADAO_LIUMANG_QIZHI的博客 1万+

基于 Langchain 开发一个完整的支持多轮数据分析(直连 mysql 数据,多表综合分析 SQL 取数,数据分析,报表生成)ChatBI 系统(前后端完整实现源代码)

ChatBI系统开发摘要 本文介绍了基于Langchain的多轮数据分析ChatBI系统开发方案。该系统支持MySQL数据库连接,提供多表分析、SQL查询、数据分析和报表生成功能。系统采用前后端分离架构:前端使用React+Ant Design+ECharts实现交互界面;后端基于FastAPI搭建服务,集成Langchain处理自然语言到SQL的转换;核心技术栈还包括SQLAlchemy、Pandas和Matplotlib。 系统核心模块包括: 数据库连接层:使用SQLAlchemy管理MySQL连接 L

AI天才研究院 814

POJ 3279 Fliptile(二进制枚举、递推、POJ 1426 Find The Multiple、详解)

POJ 3279 Fliptile 测试平台 Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which

Zhengyangxinn的博客 220

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

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

android 蓝牙通讯demo

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

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

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

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

【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

POJ - 1426 Find The Multiple 【DFS】

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

dianxi0949的博客 71

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

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

【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

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 || 二进制枚举)

题目: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)

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

ysCover 482

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 3278 Catch That Cow —————— BFS
下一篇: POJ 2312 Battle City ——————BFS
陶鸿杰
博客等级 码龄9年 93粉丝 298原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值