poj1426 Find The Multiple (DFS)
Time Limit: 1000MS | Memory Limit: 10000K | |||
Total Submissions: 41845 | Accepted: 17564 | Special Judge |
Description
Input
Output
Sample Input
2
6
19
0
Sample Output
10
100100100100100100
111111111111111111
Source
#include<iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
const ll mod=;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
//head
#define MAX 1000
int n;
int flag;
void dfs(int cur,ll sum)
{
if(cur==)return ;
if(flag) return ;
if(sum%n==&&sum!=)
{
flag=;
cout<<sum<<endl;
return ;
}
else
dfs(cur+,sum*),dfs(cur+,sum*+);
}
int main()
{
cin.tie();
cout.tie();
ios::sync_with_stdio();
while(cin>>n)
{
if(n==)break;
flag=;
dfs(,);
}
return ;
}
poj1426 Find The Multiple (DFS)的更多相关文章
- POJ1426——Find The Multiple
POJ1426--Find The Multiple Description Given a positive integer n, write a program to find out a non ...
- poj1426 Find The Multiple(c语言巧解)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36335 Accepted: 151 ...
- POJ-2356 Find a multiple(DFS,抽屉原理)
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7133 Accepted: 3122 Speci ...
- POJ1426 Find The Multiple (宽搜思想)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24768 Accepted: 102 ...
- poj1426 Find The Multiple
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14622 Accepted: 593 ...
- POJ1426:Find The Multiple(算是bfs水题吧,投机取巧过的)
http://poj.org/problem?id=1426 Description Given a positive integer n, write a program to find out a ...
- POJ1426 Find The Multiple —— BFS
题目链接:http://poj.org/problem?id=1426 Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Tota ...
- [POJ]Find The Multiple(DFS)
题目链接 http://poj.org/problem?id=1426 题意 输入一个数n,输出任意一个 只含0.1且能被n整除的数m.保证n<=200,m最多100位. 题解 DFS/BFS都 ...
- POJ1426——Find The Multiple (简单搜索+取余)
题意: 给一个数n,让你找出一个只有1,0,组成的十进制数,要求是找到的数可以被n整除. 用DFS是搜索 当前位数字 (除最高位固定为1),因为每一位都只有0或1两种选择,换而言之是一个双入口BFS. ...
随机推荐
- Nginx 教程 (1):基本概念
简介 嗨!分享就是关心!所以,我们愿意再跟你分享一点点知识.我们准备了这个划分为三节的<Nginx教程>.如果你对 Nginx 已经有所了解,或者你希望了解更多,这个教程将会对你非常有 ...
- Spring Boot 项目 Maven 配置
在配置基于Maven的Spring Boot项目的过程中,打包运行出现了一系列错误. 比如: mvn 中没有主清单属性.java.lang.NoClassDefFoundError: org/spri ...
- [Luogu2365]任务安排(斜率优化)
[Luogu2365]任务安排 题目描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成 ...
- OtterCTF - Reverse - Msg Me This
原文地址:Msg Me This 题目 Category: Reverse Engineering Points: 500 Solves: 15 Description: Rick created a ...
- 工欲善其事,必先利其器——React Native的 IDE
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/yayayaya20122012/article/details/51119801之前的文章中,我们已 ...
- BZOJ2839 集合计数 二项式反演
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=2839 题解 二项式反演板子题. 类似于一般的容斥,我们发现恰好 \(k\) 个不怎么好求,但是 ...
- C# 批量修改考勤设备时间
自己工作中用到的小程序,每次远行后批量改一次 如下: 其中的zkemkeeper是中控的相关组件,因是系统组件,须要先注册相关文件后才有效 using System; using System.Col ...
- sql语句中判断空值的函数
COALESCE()函数 主流数据库系统都支持COALESCE()函数,这个函数主要用来进行空值处理,其参数格式如下: COALESCE ( expression,value1,value2……,v ...
- Install packages failed: Installing packages: error occurred. ------简单的问题常常会被忽略
用 pip install 安装了wxpy这个库,但是使用的时候却报错:ImportError: No module named wxpy 我先用 pip list 查看了一下,发现这个库是已经存在的 ...
- vue项目中引入mui.poppicker.js文件时报错“Uncaught ReferenceError: mui is not defined”
解决:在mui.js的源文件后最后加上 window.mui = mui;