/** * Finds and prints n prime integers * Jeff Offutt, Spring 2003 */ private static void printPrimes(int n) { int curPrime; //Value currently conside ...
分类:
其他好文 时间:
2018-03-26 22:25:49
阅读次数:
162
本系列文章由 Nick-Pem 原创编写,转载请说明出处。 作者:Nick-Pem 邮箱:nickpem@foxmail.com 留坑 ...
分类:
编程语言 时间:
2018-03-24 18:33:52
阅读次数:
179
代码(修改版,可运行) package tjuscsst_hw3; public class hw3 { / Finds and prints n prime integers Jeff Offutt, Spring 2003 / private static int MAXPRIMES = 100 ...
分类:
其他好文 时间:
2018-03-24 18:32:24
阅读次数:
189
题目描述 给定一棵 $n$ 个点的树,边有边权。求简单路径上的边的乘积为完全平方数的点对 $(x,y)\ ,\ x\ne y$ 的数目。 题解 Hash 一个数是完全平方数,当且仅当每个质因子出现次数都是偶数。 因此给每一个质因子赋一个随机权值,一个数的权值等于它所有出现次数为奇数的质因子权值的异或 ...
分类:
其他好文 时间:
2018-03-21 20:00:54
阅读次数:
218
1.时间处理 PAT中有些问题把时间转换为以 s 为单位可以简化很多操作。 2.日期处理 3.进制转换 4.最大公约数、最小公倍数 5.分数的输入形式 6.判断是否为素数(Prime) N不会被除自己以外的大于根号N的整数整除(减少运算复杂度) 7.C++ sort()排序函数 8.字符串Hash ...
分类:
编程语言 时间:
2018-03-21 14:07:39
阅读次数:
230
蒟蒻对这题的思路很简单,懒得想太多复杂的细节,先打一个O(n)的暴力算法,再一次像下方粘的代码这样输出 cpp freopen("DABIAO.ans","w",stdout); bool a[10010000]; cout using namespace std; int a[101010000] ...
分类:
其他好文 时间:
2018-03-21 00:11:15
阅读次数:
346
Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance, ...
分类:
其他好文 时间:
2018-03-20 22:58:42
阅读次数:
342
BZOJ_3239_Discrete Logging_BSGS 题意:Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 2 <= N < P, compute the discrete logarit ...
分类:
其他好文 时间:
2018-03-17 23:25:13
阅读次数:
176
内容:判断质数 持续更新 # __author: _nbloser # date: 2018/2/4 import math def is_prime(number): num_sqrt = int(math.sqrt(number)) for i in range(2, num_sqrt + 1) ...
分类:
编程语言 时间:
2018-03-15 00:33:45
阅读次数:
159
Description "题库链接" 两个人 Van♂ 游戏。给出 $n$ 个正整数 $a_i$ 。两人轮流操作,每次选出一个素数 $p$ 和一个幂数 $k$ ,选择的前提为该 $n$ 个数中有 $p^k$ 的倍数。接着将所有的 $p^k$ 的倍数除以 $p^k$ 。变成新的序列,继续操作。不能操作 ...
分类:
其他好文 时间:
2018-03-14 15:54:41
阅读次数:
145