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 ...
随机推荐
- SaltStack远程执行命令
编辑fansik_cmd.sls文件: 内容如下: fansik_cmd: cmd.run: - unless: - test -f /tmp/fansik.txt - t ...
- Linux:文件
Linux:文件 文件属性 用户分为三种:文件拥有者.群组以及其它人,对不同的用户有不同的文件权限. 使用 ls 查看一个文件时,会显示一个文件的信息,例如 drwxr-xr-x. 3 root ro ...
- Linux Shell编程 sort、wc命令
sort命令:字符串排序 sort 命令可以依据不同的数据类型来进行排序.sort 将文件的每一行作为一个单位,相互比较.比较原则是从首字符向后,依次按 ASCII 码值进行比较,最后将它们按升序输出 ...
- Linux Shell基础 Bash常见命令 history、alias命令以及常用快捷键
概述 shell中常见命令history 历史纪录命令:history 命令格式如下: [root@localhost ~]# history [选项] [历史命令保存文件] -c:清空历史命令: ...
- 查看linux系统版本信息(Oracle Linux、Centos Linux、Redhat Linux、Debian、Ubuntu)
一.查看Linux系统版本的命令(3种方法) 1.cat /etc/issue,此命令也适用于所有的Linux发行版. [root@S-CentOS home]# cat /etc/issue Cen ...
- C语言math.h库函数中atan与atan2的区别
源: C语言math.h库函数中atan与atan2的区别 C语言中的atan和atan2
- Nagios 服务安装
Nagios 环境部署 安装服务包 操作系统:Linux Centos 6.4 32位 安装包:nagios-3.4.3.tar.gz 安装包:nagios-plugins-1.4.13.tar.gz ...
- Ubuntu或Linux搭建网站环境常见问题详解
本屌丝常见的问题已经全部记录如下,如大家有其他问题欢迎随时跟我进行交流. 1.无法进行软件源安装 提示信息:Package has no installation candidate 具体信息如下: ...
- 百度竞价推广URL通配符使用说明
{keywordid} 被替换为触发该创意的关键词ID(全局唯一ID,不是字面ID),当没有对应的keywordid时,替换为0. {creative} 被替换为所点击的创意ID(全局唯一ID). 2 ...
- java 项目中每个jar包的作用总结
别人的总结 1.Struts2 1)commons-fileupload :2)common-io:文件上传 3)commons-lang:它扩展了标准 java.langAPI ArrayUtils ...