Humble Numbers(hdu1058)】的更多相关文章

Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14047    Accepted Submission(s): 6108 Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble numb…
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Write a program to find and print the nth element i…
[CF55D]Beautiful numbers(动态规划) 题面 洛谷 CF 题解 数位\(dp\) 如果当前数能够被它所有数位整除,意味着它能够被所有数位的\(lcm\)整除. 所以\(dp\)的时候前面所有数的\(lcm\)要压进\(dp\)值中. 又因为\(lcm\)的余数也是有意义的,但是又不能暴力记, 所以记录一下\([1,9]\)所有数的\(lcm\)也就是\(2520\)就好了. 但是数组太大,实际上,有意义的\(lcm\)个数只有不到\(50\)个,重新编号就可以压缩状态了.…
Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14584    Accepted Submission(s): 6313 Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble numbe…
题意:给你k(≤100)个质数,求质因子只包含它们的第n大的数. 题解: 方法一:维护一个数组,一开始只有给出的质数在里面,用每个质数去乘以数组中每个数,然后归并排序,长度保留到n,一轮接一轮,直到乘出来的新出现的数大于原来最大的数,那么如果当前是用最小的质数都没产生新的前n大的数,那么第n个数就是第n大的数.否则跳转到用最小的质数去乘.具体见代码. /* TASK: humble LANG: C++ */ #include<cstdio> #include<algorithm>…
Round Numbers Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 11   Accepted Submission(s) : 8 Problem Description The cows, as you know, have no fingers or thumbs and thus are unable to play Sci…
1023 Have Fun with Numbers(20 分) Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly t…
题目描述: D. Vus the Cossack and Numbers Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He wants to choose a sequence bb the size of which is nn such that the sum of all numbers is 00 and each bibi is ei…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1058 解题报告:输入一个n,输出第n个质因子只有2,3,5,7的数. 用了离线打表,因为n最大只有5842. #include<stdio.h> #define INT __int64 INT ans[] = { ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,…
题意: 一个数的质因子如果只是2,3,5,7中的若干个.则这个数叫做humble number. 例如:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... 给n,问第n个humble number是多少. 思路: 所有的humble数的构造都是:(2^a)*(3^b)*(5^c)*(7^d).a,b,c,d大于等于0. X=a+b+c+d代表这个数是第X个humble数. 假设前i-1个humble…