思路:

2的最近可以整除的数是10

所以,很关键的一点,只要是偶数,例如:

6:2*3,可以拆分为能够被2整除和能够被3整除的乘积,所以,10*111=1110

144:72*2,8*9*2,2*2*2*2*3*3,能够整除9的后面加4个0,1111111110000

java至于素数,java暴力打表

#include<stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
string arr[]={
"","","","","","","","","","","","","","",
"","","","","","","","","",""
,"","","","","","","","",""
,"","","","","","","","","",
"","","","","","","","",
"","","","","","","","","",
"","","","","","","","",
"","","","","","","","","",
"","","","","","","","",
"","","","","","","","",
"","","","","","","","","",
"","","","","","","","","","","","","","","","",
"","","","","","","","",
"","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","",
"","","","","",
"","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","",
"","","","","",""
};
//189没有暴力出来,然而,测试数据没有189
int main()
{
int n;
while (scanf("%d", &n)!=EOF && n) {
cout<<arr[n]<<endl;
}
return ;
}

poj-1426-Find The Multiple(打表水过)的更多相关文章

  1. 广搜+打表 POJ 1426 Find The Multiple

    POJ 1426   Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25734   Ac ...

  2. DFS/BFS(同余模) POJ 1426 Find The Multiple

    题目传送门 /* 题意:找出一个0和1组成的数字能整除n DFS:200的范围内不会爆long long,DFS水过~ */ /************************************ ...

  3. POJ 1426 Find The Multiple --- BFS || DFS

    POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至 ...

  4. POJ 1426 Find The Multiple(寻找倍数)

    POJ 1426 Find The Multiple(寻找倍数) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 Given ...

  5. POJ.1426 Find The Multiple (BFS)

    POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个 ...

  6. POJ 1426 Find The Multiple (DFS / BFS)

    题目链接:id=1426">Find The Multiple 解析:直接从前往后搜.设当前数为k用long long保存,则下一个数不是k*10就是k*10+1 AC代码: /* D ...

  7. POJ 1426 Find The Multiple(数论——中国同余定理)

    题目链接: http://poj.org/problem?id=1426 Description Given a positive integer n, write a program to find ...

  8. POJ 1426 - Find The Multiple - [DP][BFS]

    题目链接:http://poj.org/problem?id=1426 Given a positive integer n, write a program to find out a nonzer ...

  9. POJ - 1426 Find The Multiple(搜索+数论)

    转载自:優YoU  http://user.qzone.qq.com/289065406/blog/1303946967 以下内容属于以上这位dalao http://poj.org/problem? ...

  10. poj 1426 Find The Multiple (bfs 搜索)

    Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18012   Accepted: 729 ...

随机推荐

  1. 基于nodejs的wiki系统

    jingo:        https://github.com/claudioc/jingo nodewiki:    https://github.com/nhoss2/nodewiki Tidd ...

  2. Android 编译错误——布局 Error parsing XML: not well-formed (invalid token)

    在修改了Android布局文件后,编译出现Error parsing XML: not well-formed (invalid token). 首先先排查xml文件的编码格式是否为UTF-8, &l ...

  3. oracle数据向历史表数据迁移————procedure

    create or replace procedure remove_refund_his_pro isbegin declare cursor refund_query_cur is select ...

  4. vuex的 例子

    最近在学习vuejs,一直有听说vuex,用来实现多组件共享的一种状态管理模式,但是网上都说,不要为了用vuex而用vuex,大概意思就是尽量少用vuex,一些小项目可以用bus来实现组件之间的传值问 ...

  5. springboot-项目属性配置

    springboot如何新建一个项目参考博客:https://www.cnblogs.com/junyang/p/8151802.html 在springboot默认生成的配置文件的格式是:appli ...

  6. TIJ读书笔记03-初始化和构造器

      TIJ读书笔记03-初始化和构造器 初始化和清理是涉及安全的两个问题,如果对象不能正确的初始化会引起很多错误,比如空指针异常等,如果不能恰当及时的清理,会占用过多资源. 构造器在创建一个类的实例的 ...

  7. 离乡与理想 Demo

    离乡与理想---理想不分黑白 踏上了火车,离开家乡背着幻梦,站累了有人叫我幸福,叫我快乐而我是没有名字的流浪的日子,已数不清有多少带着理想,一路飞翔路上遇见困难,一定要坚强因为理想已离乡 我为理想而离 ...

  8. git上面创建个人简历-链接

    github创建个人在线简历: https://segmentfault.com/a/1190000006820290

  9. Go 内置库 IO interface

    基本的 IO 接口 io 包为 I/O 原语提供了基本的接口.它主要包装了这些原语的已有实现. 由于这些接口和原语以不同的实现包装了低级操作,因此除非另行通知,否则客户端不应假定它们对于并行执行是安全 ...

  10. c++ boost库学习二:内存管理->智能指针

    写过C++的人都知道申请和释放内存组合new/delete,但同时很多人也会在写程序的时候忘记释放内存导致内存泄漏.如下所示: int _tmain(int argc, _TCHAR* argv[]) ...