当前位置:网站首页>[training Day2] torch bearer [violence] [DFS]
[training Day2] torch bearer [violence] [DFS]
2022-07-18 15:50:00 【VL——MOESR】

Ideas :
We consider constructing 01 strand , Then let it remove the smallest m
Construct with search
although bfs Better , but dfs You can pass this question
( The valley of Los Angeles cannot pass )
c o d e code code
#include<iostream>
#include<cstdio>
using namespace std;
long long n;
long long ans=1e18;
void dfs(long long x, long long m)
{
if(m%n==0)
{
ans=min(ans, m/n);
return;
}
if(x>18)
return;
dfs(x+1, m*10+1);
dfs(x+1, m*10);
}
int main()
{
scanf("%lld", &n);
dfs(1, 1);
if(ans==1e18)
printf("no solution");
else printf("%lld %lld", ans);
return 0;
}
边栏推荐
- Codeforces Round #806 (Div. 4)
- 从一篇防范钓鱼邮件的通知说起
- AcWing 135. Maximum subsequence sum
- Build your own website (23)
- Compilation optimization from the release of Xiaomi 10
- gradle
- leetcode:378. The k-th smallest element in an ordered matrix
- . Net to publish the project to the server in the form of file
- Error establishing connection between MySQL and idea
- gradle
猜你喜欢
随机推荐
高性能定時器
ncnn 编译与使用 pnnx 编译与使用
AutoJs学习-变声器模板
2022 pole technology communication - anmou technology opens a new chapter of commercialization
新功能上线需要发版本,回归测试中总是出现之前没有的问题
Differences between get requests and post requests and usage examples
C language -- the implementation of common string functions
HMS core graphics and image technology shows the latest functions and application scenarios, and accelerates the construction of digital intelligence life
Async function implements multiple request processing
Fun ping command
Processing TCP and UDP services simultaneously with i/o multiplexing
如何用断言思路优雅地处理代码异常
HMS core graphics and image technology shows the latest functions and application scenarios, and accelerates the construction of digital intelligence life
1111111111111
Detailed explanation of C language "address book"
AcWing 135. 最大子序和
.net发布项目到服务器,文件形式
Calculate the Euclidean distance between the row vectors of two matrices
UE4/5中的旋转:三个欧拉角Picth、Yaw、Roll及FRotator
page-break-before\page-break-inside\page-break-after用法


![[two way PWM drive of Renesas ra6m4 development board]](/img/97/aebef780cf8f61c51a27ba3cc7054d.png)



![[halcon] writeimage save image crash](/img/c6/fdfe031f0836a61dbc3cf3634e244e.png)

