题目大意:给定N, M,求1 3 4 using namespace std; 5 #define ll long long 6 #define N 10000000 7 int mu[N+5] , prime[N+5] , tot , f[N+5] , sum[N+5]; 8 bool chec....
分类:
其他好文 时间:
2015-09-06 21:39:03
阅读次数:
198
非常有用的一些代码//求阶乘function fac(n:longint):longint;var i:longint;begin fac:=1; for i:=2 to n do fac:=fac*i;end;//素数判断function prime(a:longint):boolea...
分类:
其他好文 时间:
2015-09-05 16:20:09
阅读次数:
198
题目链接 五个数,任意两个数的任意链接后的数还是质数 满足这个条件的最小五个数的和是多少? 结果:26033 纯暴力破解: package projecteuler51to60; import java.util.ArrayList; import java.util.List; import ja...
分类:
其他好文 时间:
2015-09-04 18:27:51
阅读次数:
234
7.7 Design an algorithm to find the kth number such that the only prime factors are 3,5, and 7.这道题跟之前LeetCode的那道Ugly Number II 丑陋数之二基本没有啥区别,具体讲解可参见那篇,...
分类:
其他好文 时间:
2015-09-03 23:26:06
阅读次数:
466
Ugly NumberWrite a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, ...
分类:
其他好文 时间:
2015-09-03 21:35:44
阅读次数:
169
题目:Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For e...
分类:
其他好文 时间:
2015-09-02 07:09:03
阅读次数:
118
1059. Prime Factors (25)时间限制50 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者HE, QinmingGiven any positive integer N, you are supposed to find all of its p...
分类:
其他好文 时间:
2015-09-02 01:56:58
阅读次数:
153
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
For example, 6, 8 are ugly while 14 is
not ugly si...
分类:
其他好文 时间:
2015-09-02 00:41:56
阅读次数:
155
Write a program to find the n-th ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first ...
分类:
其他好文 时间:
2015-09-02 00:41:00
阅读次数:
224
题意:问一个数字能被多少种连续的质数相加得到。解法:一开始没看见是连续的……SB了半天……后来打了个表……就这样吧代码:#include#include#include#include#include#include#include#include#include#include#include#i...
分类:
其他好文 时间:
2015-09-01 21:22:08
阅读次数:
216