【POJ1338】Ugly Numbers(暴力打表)
打表大军是一股邪恶势力→_→
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <limits.h>
#include <vector>
using namespace std; vector<long long> ans; int plot_form() {
ans.push_back();
freopen ("out.txt", "w", stdout);
int cnt = ;
for (long long i = ; i < && cnt != ; ++ i) {
long long x = i;
bool flag = ;
while (x != ) {
if (x % == ) {
x /= ;
} else if (x % == ) {
x /= ;
} else if (x % == ) {
x /= ;
} else {
flag = ;
break;
}
}
if (flag == ) {
ans.push_back(i);
cnt ++;
}
} vector<long long> :: iterator it = ans.begin();
cnt = ;
cout << "{";
for (;it != ans.end(); it ++) {
cout << *it << ",\t\t";
cnt ++;
if (cnt % == ) cout << endl;
} return ;
} long long res[] =
{, , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
, , , , ,
}; int main () {
//plot_form();
ios :: sync_with_stdio(false);
int n;
while (cin >> n) {
if ( n == ) break;
cout << res[n - ] << endl;
}
return ;
}
【POJ1338】Ugly Numbers(暴力打表)的更多相关文章
- [POJ1338]Ugly Numbers
[POJ1338]Ugly Numbers 试题描述 Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequ ...
- poj1338 Ugly Numbers 打表, 递推
题意:一个数的质因子能是2, 3, 5, 那么这个数是丑数. 思路: 打表或者递推. 打表: 若该数为丑数,那么一定能被2 或者3, 或者5 整除, 除完之后则为1. #include <ios ...
- codeforces 9 div2 C.Hexadecimal's Numbers 暴力打表
C. Hexadecimal's Numbers time limit per test 1 second memory limit per test 64 megabytes input stand ...
- HNUSTOJ-1565 Vampire Numbers(暴力打表)
1565: Vampire Numbers 时间限制: 3 Sec 内存限制: 128 MB提交: 20 解决: 9[提交][状态][讨论版] 题目描述 The number 1827 is an ...
- Ugly Numbers
Ugly Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21918 Accepted: 9788 Descrip ...
- XTU OJ 1210 Happy Number (暴力+打表)
Problem Description Recently, Mr. Xie learn the concept of happy number. A happy number is a number ...
- HDU 1216 Assistance Required(暴力打表)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1216 Assistance Required Time Limit: 2000/1000 MS (Ja ...
- NYOJ1097 Ugly Numbers 【丑数】
Ugly Numbers 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描写叙述 Ugly numbers are numbers whose only prime fact ...
- Ugly Numbers UVA - 136(优先队列+vector)
Problem Description Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, ...
- ACM/ICPC 之 暴力打表(求解欧拉回路)-编码(POJ1780)
///找到一个数字序列包含所有n位数(连续)一次且仅一次 ///暴力打表 ///Time:141Ms Memory:2260K #include<iostream> #include< ...
随机推荐
- http常见错误
100:继续 客户端应当继续发送请求.客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应. 101: 转换协议 在发送完这个响应最后的空行后,服务器将会切换到在Upgrade 消 ...
- JS浏览器对象-History对象
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- JS(三)
1.检查用户名中是否含有特殊字符: <!DOCTYPE html> <html lang="en"> <head> <meta chars ...
- 总结QueueUserWorkItem传参的几种方式
最近在学习citrix的xenserver6.2的源代码,发现多处用到System.Threading命名空间下的ThreadPool.QueueUserWorkItem方法: public stat ...
- kvm cobbler无人值守批量安装操作系统
kvm cobbler无人值守批量安装操作系统 cobbler:一个自动网络安装系统的工具,集成PEX.dhcp.dns.tftpd.sync等服务.可以供大家管理安装操作系统 kvm:Linux系统 ...
- Heritrix源码分析(十五)
开博客以及建立Heritrix 群有一段时间了(这里谢谢大家的关注),这篇博客将整理这段时间所遇到的问题.同时由于自己从今年5月份开始就不怎么接触Heritrix,很多东西开始遗忘(不过里面思想没忘) ...
- igmpproxy源码学习——igmpProxyInit()
igmpproxy源码学习--igmpProxyInit()函数具体解释.igmpproxy初始化 在执行igmpproxy的主程序igmpproxyRun()之前须要对igmpproxy进行一些配置 ...
- 第一篇博客关于Log4net的配置记录
说明:本程序演示如何利用log4net记录程序日志信息.log4net是一个功能著名的开源日志记录组件.利用log4net可以方便地将日志信息记录到文件.控制台.Windows事件日志和数据库(包括M ...
- CodeFirst解决数据迁移问题
CodeFirst解决数据迁移问题 分类: 数据库 设计模式 c#2013-04-24 17:56 137人阅读 评论(0) 收藏 举报 工程用的MVC + Entity Framework,根据Co ...
- android上line-height的问题
关于line-height大家应该非常熟悉了吧,就是用来做垂直居中的,屡试不爽,基本上没有什么问题,但是最近一个项目,测试提了一个bug,看图吧. 从别处窃的图,这个问题只有安卓上才能复现,做了dem ...