
数论
文章平均质量分 79
Megumin
这个作者很懒,什么都没留下…
展开
-
UVa1635 Irrelevant Elements
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from 0 to m - 1. He thinks that standard random number generators are not good enough, so he原创 2016-07-10 23:06:02 · 604 阅读 · 0 评论 -
Hdu3037 Saving Beans Lucas定理
DescriptionAlthough winter is far away, squirrels have to work day and night to save beans. They need plenty of food to get through those long cold days. After some time the squirrel family thinks t原创 2016-07-15 18:52:36 · 343 阅读 · 0 评论 -
Hdu5776 sum 抽屉原理+同余定理
Problem DescriptionGiven a sequence, you're asked whether there exists a consecutive subsequence whose sum is divisible by m. output YES, otherwise output NO InputThe first line of the input原创 2016-08-07 20:05:12 · 524 阅读 · 3 评论 -
CSU1803 2016 同余
Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. a×b 是 2016 的倍数。Input输入包含不超过 30 组数据。每组数据包含两个整数 n,m (1≤n,m≤109).Output对于每组数据,输出一个整数表示满足条件的原创 2016-09-04 16:08:37 · 1461 阅读 · 0 评论 -
CodeForces711E ZS and The Birthday Paradox 费马小定理求逆元
ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% chance that some two of them share the same birt原创 2016-09-04 17:03:32 · 733 阅读 · 0 评论 -
LightOJ1007 Mathematically Hard 欧拉函数+前缀和
DescriptionMathematically some problems look hard. But with the help of the computer, some problems can be easily solvable.In this problem, you will be given two integers a and b. You have to fi原创 2016-09-04 22:29:39 · 575 阅读 · 0 评论 -
LightOJ1215 Finding LCM
LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LCM (a, b, c) = L if and only if L is the least integer which is divisible by a, b and c.You will be given a, b and L.原创 2016-09-04 22:59:06 · 436 阅读 · 0 评论 -
LightOJ1278 Sum of Consecutive Integers 素数筛法+数学分析
DescriptionGiven an integer N, you have to find the number of ways you can express N as sum of consecutive integers. You have to use at least two integers.For example, N = 15 has three solutions,原创 2016-09-04 23:19:02 · 549 阅读 · 0 评论 -
LightOJ1045 Digits of Factorial 求n的阶乘在k进制下的位数
DescriptionFactorial of an integer is defined by the following functionf(0) = 1f(n) = f(n - 1) * n, if(n > 0)So, factorial of 5 is 120. But in different bases, the factorial may be different.原创 2016-09-05 12:35:05 · 582 阅读 · 0 评论 -
LightOJ1067 Combinations Lucas定理裸题
DescriptionGiven n different objects, you want to take k of them. How many ways to can do it?For example, say there are 4 items; you want to take 2 of them. So, you can do it 6 ways.Take 1, 2T原创 2016-09-05 19:57:16 · 745 阅读 · 0 评论 -
LightOJ1014 Ifter Party
DescriptionI have an Ifter party at the 5th day of Ramadan for the contestants. For this reason I have invited C contestants and arranged P piaju's (some kind of food, specially made for Ifter). Eac原创 2016-09-05 21:57:53 · 513 阅读 · 0 评论 -
LightOJ1109 False Ordering 筛法求约数个数+结构体排序
We define b is a Divisor of a number a if a is divisible by b. So, the divisors of 12 are 1, 2, 3, 4, 6, 12. So, 12 has 6 divisors.Now you have to order all the integers from 1 to 1000. x will come原创 2016-09-06 22:04:26 · 377 阅读 · 0 评论 -
SPOJ4491 Primes in GCD Table 莫比乌斯反演+分块+前缀和
DescriptionJohnny has created a table which encodes the results of some operation -- a function of two arguments. But instead of a boring multiplication table of the sort you learn by heart at prep-原创 2016-07-15 10:40:34 · 450 阅读 · 0 评论 -
SPOJ7001 Visible Lattice Points 莫比乌斯反演+分块+前缀和
DescriptionConsider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from corner at (0,0,0) ? A point X is visible from point Y iff n原创 2016-07-14 23:01:36 · 395 阅读 · 0 评论 -
UVa11582 巨大的斐波那契数 循环节计算+快速幂
The i ’th Fibonacci number f(i) is recursively defined in the following way:• f(0) = 0 and f(1) = 1• f(i + 2) = f(i + 1) + f(i) for every i ≥ 0Your task is to compute some values of this sequenc原创 2016-07-10 23:17:07 · 770 阅读 · 0 评论 -
Hdu5317 RGCDQ
Problem DescriptionMr. Hdu is interested in Greatest Common Divisor (GCD). He wants to find more and more interesting things about GCD. Today He comes up with Range Greatest Common Divisor Query (RG原创 2016-07-11 14:11:25 · 342 阅读 · 0 评论 -
UVa12716 GCD XOR
DescriptionGiven an integer N, nd how many pairs (A; B) are there such that: gcd(A; B) = A xor B where1Here gcd(A; B) means the greatest common divisor of the numbers A and B. And A xor B is原创 2016-07-11 16:34:41 · 472 阅读 · 0 评论 -
UESTC621 吴神的大脑
Problem DescriptionGiven the value of N, you will have to find the value of G. The meaning of G is given in the following code G=0; for(i=1;i G+=gcd(i,j); /*Here gcd() is a functi原创 2016-07-13 14:38:23 · 362 阅读 · 0 评论 -
Poj3090 Visible Lattice Points 欧拉函数求和
DescriptionA lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y) d原创 2016-07-13 14:07:59 · 307 阅读 · 0 评论 -
LightOJ1370 Bi-shoe and Phi-shoe 欧拉函数筛法
DescriptionBamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant原创 2016-07-13 13:39:49 · 384 阅读 · 0 评论 -
Hdu4497 GCD and LCM 素数筛法+分解质因数
Problem DescriptionGiven two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and lcm(x, y, z) = L? Note, gcd(x, y, z) mea原创 2016-07-13 13:05:30 · 349 阅读 · 0 评论 -
Hdu2588 GCD 欧拉函数
Problem DescriptionThe greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6. (a,b) can原创 2016-07-13 11:14:02 · 521 阅读 · 0 评论 -
POJ2992 Divisors 组合数,分解质因数
DescriptionYour task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful computation?InputThe input consists of原创 2016-07-13 11:05:19 · 973 阅读 · 0 评论 -
LightOJ1236 Pairs Forming LCM 素数筛法+分解质因数
DescriptionFind the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i n; i++ ) for( int j = i; j n; j++ )原创 2016-07-13 09:21:18 · 1046 阅读 · 1 评论 -
UVa11181 Probability|Given DFS+概率
N friends go to the local super market together. The probability of their buying something from the market is respectively. After their marketing is finished you are given the information that exactly原创 2016-07-12 15:36:33 · 350 阅读 · 0 评论 -
UVa11889 Minimum Sum LCM 分解质因数
A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible pairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4) etc. For a given positive integer N, the num原创 2016-07-12 18:25:22 · 309 阅读 · 0 评论 -
UVALive5964 LCM Extreme && UVA11426 GCD - Extreme (II) 欧拉函数筛法
UVALive5964 LCM Extreme 点击打开链接UVA11426 GCD - Extreme (II) 点击打开链接#include #include #include #include #include #include #include #include #include using namespace std;#define LL原创 2017-04-12 14:44:52 · 533 阅读 · 0 评论