poj-1426-Find The Multiple(打表水过)
思路:
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(打表水过)的更多相关文章
- 广搜+打表 POJ 1426 Find The Multiple
POJ 1426 Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 25734 Ac ...
- DFS/BFS(同余模) POJ 1426 Find The Multiple
题目传送门 /* 题意:找出一个0和1组成的数字能整除n DFS:200的范围内不会爆long long,DFS水过~ */ /************************************ ...
- POJ 1426 Find The Multiple --- BFS || DFS
POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至 ...
- POJ 1426 Find The Multiple(寻找倍数)
POJ 1426 Find The Multiple(寻找倍数) Time Limit: 1000MS Memory Limit: 65536K Description - 题目描述 Given ...
- POJ.1426 Find The Multiple (BFS)
POJ.1426 Find The Multiple (BFS) 题意分析 给出一个数字n,求出一个由01组成的十进制数,并且是n的倍数. 思路就是从1开始,枚举下一位,因为下一位只能是0或1,故这个 ...
- POJ 1426 Find The Multiple (DFS / BFS)
题目链接:id=1426">Find The Multiple 解析:直接从前往后搜.设当前数为k用long long保存,则下一个数不是k*10就是k*10+1 AC代码: /* D ...
- POJ 1426 Find The Multiple(数论——中国同余定理)
题目链接: http://poj.org/problem?id=1426 Description Given a positive integer n, write a program to find ...
- 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 ...
- POJ - 1426 Find The Multiple(搜索+数论)
转载自:優YoU http://user.qzone.qq.com/289065406/blog/1303946967 以下内容属于以上这位dalao http://poj.org/problem? ...
- poj 1426 Find The Multiple (bfs 搜索)
Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18012 Accepted: 729 ...
随机推荐
- Kafka的架构
1.Kafka整体架构 一个典型的Kafka集群中包含若干producer(可以是web前端产生的page view,或者是服务器日志,系统CPU.memory等),若干broker(Kafka ...
- cut命令学习
cut最基本的用法: -f 列号:提取第几列 -d 分隔符:按照指定分隔符分割列(默认是制表符tab) 测试用例:(制表符)
- knockout注释标签----逻辑判断(学习笔记,欢迎拍砖)
使用knockout绑定数据时,需要进行判断处理 <!-- ko if:$root.ifHaveVideo($data) --> 这里不是被注释掉的代码 是逻辑判断代码 有效的 <d ...
- 解决eclipse不识别Android手机的问题
from:http://www.apkbus.com/blog-3-39569.html 搭好Android开发环境之后,用模拟器运行Android程序没有问题,但是将手机用USB连接电脑后,电脑不识 ...
- PHP 数字转大写
<?php header("content-type:text/html;charset=utf-8"); function numToRmb($num){ $rmbNum ...
- 40个你可能不知道的Python的特点和技巧
1.拆箱 >>> a, b, c = 1, 2, 3 >>> a, b, c (1, 2, 3) >>> a, b, c = [1, 2, 3] ...
- 【HackerRank】 Find Digits
Find Digits Problem Statement Given a number you have to print how many digits in that number exactl ...
- P4121 [WC2005]双面棋盘
题目 P4121 [WC2005]双面棋盘 貌似是刘汝佳出的题目?? 做法 线段树维护并查集 线段树分治\(1\)~\(n\)行,我们要考虑维护的肯定是黑.白各自的联通块数量 考虑区间合并,其实就与中 ...
- HttpUtils工具类
HttpUtils工具类 package net.hs.itn.teng.common.util; import java.io.IOException; import java.io.Unsuppo ...
- strspn() 和 strcspn() 函数【转】
本文转载自:https://flyer103.wordpress.com/2011/06/03/strspn-%E5%92%8C-strcspn-%E5%87%BD%E6%95%B0/ 前几天在看一本 ...