/*
题意:求第N个productivity property数是谁。
(productivity property数:就是这个数可以由另外的数的各个位上的乘积得到。)
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<math.h>
using namespace std;
typedef long long int64;
//typedef __int64 int64;
typedef pair<int64,int64> PII;
#define MP(a,b) make_pair((a),(b))
const int maxn = 10000005;
const int64 M = 1e18;
const int inf = 0x7fffffff;
const double pi=acos(-1.0);
const double eps = 1e-8; int64 ans[ maxn+5 ]; int64 fmin( int64 a,int64 b,int64 c,int64 d ){
if( a>b ) a = b;
if( a>c ) a = c;
if( a>d ) a = d;
return a;
} void init(){
//memset( ans,0,sizeof( ans ) );
ans[ 1 ] = 1;
int cnt2 = 1,cnt3 = 1,cnt5 = 1,cnt7 = 1;
for( int i=2;i<maxn;i++ ){
ans[i] = fmin( ans[cnt2]*2,ans[cnt3]*3,ans[cnt5]*5,ans[cnt7]*7 );
if( ans[i]==ans[cnt2]*2 ) cnt2 ++;
if( ans[i]==ans[cnt3]*3 ) cnt3 ++;
if( ans[i]==ans[cnt5]*5 ) cnt5 ++;
if( ans[i]==ans[cnt7]*7 ) cnt7 ++;
if( ans[i]>M ) break;
}
} int main(){
init();
int T;
scanf("%d",&T);
while( T-- ){
int n;
scanf("%d",&n);
printf("%lld\n",ans[n]);
}
return 0;
}

POJ3307+找规律的更多相关文章

  1. hdu 3951 - Coin Game(找规律)

    这道题是有规律的博弈题目,,, 所以我们只需要找出规律来就ok了 牛人用sg函数暴力找规律,菜鸟手工模拟以求规律...[牢骚] if(m>=2) { if(n<=m) {first第一口就 ...

  2. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  3. hdu4952 Number Transformation (找规律)

    2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...

  4. CF456B Fedya and Maths 找规律

    http://codeforces.com/contest/456/problem/B CF#260 div2 B Fedya and Maths Codeforces Round #260 B. F ...

  5. hdu 4731 2013成都赛区网络赛 找规律

    题意:找字串中最长回文串的最小值的串 m=2的时候暴力打表找规律,打表可以用二进制枚举

  6. 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake

    题目传送门 /* 水题 找规律输出 */ #include <cstdio> #include <iostream> #include <cstring> #inc ...

  7. 找规律 ZOJ3498 Javabeans

    Javabeans are delicious. Javaman likes to eat javabeans very much. Javaman has n boxes of javabeans. ...

  8. C基础之递归(思想很重要,学会找规律)

    递归思想的条件:1.函数自己调用自己 2.函数必须有一个固定的返回值(如果没有这个条件会发生死循环) ----规律很重要 简单递归题目一: 设计一个函数计算一个整数的n次方,比如2的3次方,就是8 步 ...

  9. BZOJ-1228 E&D 博弈SG+找啊找啊找规律

    讨厌博弈,找规律找半天还是错的.... 1228: [SDOI2009]E&D Time Limit: 10 Sec Memory Limit: 162 MB Submit: 666 Solv ...

随机推荐

  1. bzoj1644 [Usaco2007 Oct]Obstacle Course 障碍训练课

    Description 考虑一个 N x N (1 <= N <= 100)的有1个个方格组成的正方形牧场.有些方格是奶牛们不能踏上的,它们被标记为了'x'.例如下图: . . B x . ...

  2. Asp.Net的核心对象

    原文地址:http://www.cnblogs.com/fish-li/archive/2011/08/21/2148640.html 1.HttpRuntime 对象在处理Http请求的asp.ne ...

  3. UESTC_邱老师的脑残粉 2015 UESTC Training for Graph Theory<Problem D>

    D - 邱老师的脑残粉 Time Limit: 12000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Sub ...

  4. java没有条件编译

    摘自http://maosidiaoxian.iteye.com/blog/1290740 条件编译绝对是一个好东西.如在C或CPP中,可以通过预处理语句来实现条件编译.代码如下: #IFDEF DE ...

  5. telnet如何操作Memcached缓存系统?

    4.(1)telnet操作Memcached 许多语言都实现了连接memcached的客户端,其中以Perl.PHP为主.仅仅memcached网站上列出的语言就有:• Perl • PHP • Py ...

  6. HDU 4521 间隔》=1的LIS 线段树+dp

    九野的博客,转载请注明出处:http://blog.csdn.net/acmmmm/article/details/11991119 题意: n个数 d个距离 下面n个数的序列,求序列中的最长单调递增 ...

  7. Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent

    修改pom.xml文件,添加以下属性 <project> ... <properties> <project.build.sourceEncoding>UTF-8& ...

  8. HEVC测试序列(百度云网盘分享)

    巧妇难为无米之炊,身为一个码农怎能碗里没有米呢?想必很多朋友都碰到下载测试序列的困惑,为了减少麻烦,现提供HEVC所有测试序列的下载,上传到百度云网盘上,方便大家下载.主要的测试序列如下: Test ...

  9. Android默认启动程序问题

    参考地址:http://www.cnblogs.com/Lewis/p/3316946.html 怎么让我们自己开发的Android程序设为默认启动呢?其实很简单,只要在AndroidManifest ...

  10. appium安装 For windows

    java sdk,android SDK,maven,genymotion全部已经安装完毕,只是安装appium 因为现在的appium(AppiumForWindows_1_4_13_1)需要自己重 ...