prime 数论 题意:分别求 1*n、2*n、3*n、... n*n 关于模 p 的逆元。p 是质数,n < p。 初步解法:暴力枚举。因为 a 关于模 p 的逆元 b 满足 ab mod p = 1,而 b < p,所以可以枚举 b。但是由于没有用 long long 导致爆零。 (下文用 ie...
分类:
其他好文 时间:
2014-08-18 22:01:12
阅读次数:
288
题目链接:uva 1404 1404 - Prime k-tuple
题目大意:如果k个相邻的素数p1,p2,…,pk,满足pk?p1=s,称这些素数组成一个距离为s的素数k元组,给定区间a,b,求有多少个距离s的k元组。
解题思路:筛选素数法,先预处理出[1, sqrt(inf)]的素数表,然后对给定区间[a,b]根据预处理出的素数表筛选出素数即可。
#include
#incl...
分类:
其他好文 时间:
2014-08-17 17:07:42
阅读次数:
211
F -Strange Way to Express IntegersTime Limit:1000MSMemory Limit:131072KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionElina is reading a book wr...
分类:
其他好文 时间:
2014-08-17 11:37:32
阅读次数:
326
POJ 3086 Triangular Sums
还是为了积分。。。...
分类:
其他好文 时间:
2014-08-16 21:12:21
阅读次数:
208
已知n,k,操作k次,每次操作求大于n且能被次数i整除的最小的数
已知x*i,所以(i+1)*y>=x*i,y>=x-[x/(i+1)],当x
#include
int main()
{
long long n,k;
long long i;
int time=0;
while(scanf("%I64d%I64d",&n,&k)!=-1)
{
...
分类:
其他好文 时间:
2014-08-16 15:07:40
阅读次数:
162
Problem Description
Teacher Mai has a multiplication table in base p.
For example, the following is a multiplication table in base 4:
* 0 1 2 3
0 00 00 00 00
1 00 01 02 03
2 00 02 10 12
3...
分类:
其他好文 时间:
2014-08-15 09:33:37
阅读次数:
190
这是我、potaty、lmz第二次训练,毕竟经验不足,加上水平不够,导致我们各种被碾压。 A -Couple doubi: 这道题是道比较水的数论。但我们都没想出来要怎么做。后来是potaty提议打个表看看,然后lmz打出表后发现了规律。我还没细看,待研究后再补全。 D -Task: ...
分类:
其他好文 时间:
2014-08-14 16:21:38
阅读次数:
222
Problem APlay with Floor and Ceilhttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=18&page=show_problem&problem=1614扩展gcd求...
分类:
其他好文 时间:
2014-08-14 13:30:08
阅读次数:
310
HDU 1593 find a way to escape
其实这道题要是明白原理就很简单,要是不知道,那就完蛋了。...
分类:
其他好文 时间:
2014-08-13 22:38:47
阅读次数:
272