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 ...
随机推荐
- PHP获取微信openid 简单教程
//***方法一 获取code https://open.weixin.qq.com/connect/oauth2/authorize?appid=这里是你的公众号的APPID&redirec ...
- 安装和使用jupyter
安装 pip install jupyter 使用 jupyter notebook
- 剑指offer 面试67题
面试67题: 题目: 链接:https://www.nowcoder.com/questionTerminal/1277c681251b4372bdef344468e4f26e?commentTags ...
- C#将图片白色背景设置为透明
Image image = System.Drawing.Image.FromFile(@"C:\A.JPG"); Bitmap pbitmap = new Bitmap(imag ...
- PAT 天梯赛 L2-021. 点赞狂魔 【水】
题目链接 https://www.patest.cn/contests/gplt/L2-021 题意 给出一个若干个人名,后面给出点赞的总数,以及每个赞的标签类型,输出前三个点赞狂魔,按标签类型不同数 ...
- 吐槽 坑爹的MySQL安装路径选择
一般再windows下面安装MySQL我们都会选择msi安装模式,然而安装最新版的MySQL(mysql-installer-community-5.7.11.0.msi 下载地址)发现MySQL默认 ...
- 【leetcode刷题笔记】Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, retur ...
- 【Head First Servlets and JSP】笔记12:URL重写
1.会话管理的核心在于“交换会话ID”,来回传递cookie是最简单的方法,容器通过客户端发来的JSSESIONID查找匹配的对话. 2.如果浏览器禁用了cookie,那就意味着浏览器将忽略响应首部中 ...
- 黑色CSS3立体动画菜单
在线演示 本地下载
- Linux FTP 上传一键脚本
下面来介绍一下这个 FTP 上传一键脚本 ftp_upload.sh. 用途:用于在Linux系统下搭建FTP客户端向FTP服务器端上传文件: 总结一下 ftp_upload.sh 特点:1.支持文件 ...