
数论
文章平均质量分 73
穆林幕
做个苦行僧!
展开
-
hdu1575
矩阵快速幂原创 2014-09-25 22:21:37 · 505 阅读 · 0 评论 -
[数论] Codeforces Round #324 (Div. 2)D. Dima and Lisa
Dima loves representing an odd number as the sum of multiple primes, and Lisa loves it when there are at most three primes. Help them to represent the given number as the sum of at most than three pri原创 2015-10-07 12:13:57 · 517 阅读 · 0 评论 -
[组合数]求组合数的几种方法总结
求C(n,m)%mod的方法总结1.当n,m都很小的时候可以利用杨辉三角直接求。 C(n,m)=C(n-1,m)+C(n-1,m-1);2.利用乘法逆元。 乘法逆元:(a/b)%mod=a*(b^(mod-2)) mod为素数。 逆元可以利用扩展欧几里德或欧拉函数求得: 1).扩展欧几里德:b*x+p*y=1 有解,x就是所求 2).费马小定理:b^(p-1)=1(mod p),故b*b^原创 2015-08-16 22:08:09 · 13321 阅读 · 2 评论 -
[数学]hdu5358
题意: 求出公式的值。 ∑i=1n∑j=in(⌊log2S(i,j)⌋+1)×(i+j) 分析: 主要是看到二进制的特点 log2(s)+1其实就是s二进制的位数。那么只需要求出所有区间的边界和乘上区间和的位数就好了。注意这里的数据量100000,所以s最大不超过35位,那么我们可以枚举位数,然后遍历左区间j,求出所有满足条件的r,即j,j+1,…原创 2015-08-25 14:17:51 · 615 阅读 · 0 评论 -
Codeforces Round #309 (Div. 2) C
题意: 就是给出总共有k种颜色,每种颜色有ki种,排列必须满足第i+1种的最后一种颜色必须在第i种最后一种颜色的后面,其他颜色随意。总共有多少种排列点的方法。分析:假设d[i]表示前i种的排列的数量,那么第i+1种的数量就是d[i]*C(a[1]+a[2]+..a[i+1]-1,a[i+1]-1);预先处理好排列组合数就好了,直接计算。ps:CF的比赛时间还真是有点烦,话说我一直不明白为什么我看电原创 2015-06-25 20:25:39 · 760 阅读 · 0 评论 -
[博弈论]hiho#1173 : 博弈游戏·Nim游戏·三
首先给出基本定义:对于一个游戏可能发生的局面x,我们如下定义它的sg值: (1)若当前局面x为终结局面,则sg值为0。 (2)若当前局面x非终结局面,其sg值为:sg(x) = mex{sg(y) | y是x的后继局面}。 mex{a[i]}表示a中未出现的最小非负整数。举个例子来说: mex{0, 1, 2} = 3, mex{1, 2}=0, mex{0,1,3}=2sg定理: 对于多原创 2015-06-04 22:01:07 · 635 阅读 · 0 评论 -
ural1051(数学题)
高大上的GAME啊。。原创 2014-10-18 22:32:53 · 845 阅读 · 0 评论 -
Ural1055(素数打表+分解质因数)
1055. CombinationsTime limit: 1.0 secondMemory limit: 64 MBBackgroundAs you have known MMM corporation lab researches the matter of haricot proportions in soup For every day. As we wrote原创 2014-10-17 09:22:07 · 783 阅读 · 0 评论 -
Ural1024 (LCM+置换)
1024. Permutations Time limit: 2.0 second转载 2014-10-04 16:21:22 · 622 阅读 · 0 评论 -
Ural1049 基础数论
1049. Brave BalloonistsTime limit: 2.0 secondMemory limit: 64 MBTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebra原创 2014-10-04 19:56:23 · 598 阅读 · 0 评论 -
hdu5060 (数学题,辛普森公式)
WarTime Limit: 8000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 151 Accepted Submission(s): 45Special JudgeProblem DescriptionLong long ago th原创 2014-10-11 00:18:57 · 1074 阅读 · 0 评论 -
Ural1095
1095. Nikifor 3Time limit: 1.0 secondMemory limit: 64 MBNikifor knows that a certain positive integer has in its decimal form each of the digits 1,2,3,4. You are asked to determine if Ni原创 2014-10-27 20:17:07 · 672 阅读 · 0 评论 -
【约瑟夫环】Ural1098
1098. QuestionsTime limit: 1.0 secondMemory limit: 64 MBHolding a collegiate programming contest is a very exhausting work. There is a well-known proverb that one fool can ask so many qu原创 2014-10-26 20:10:55 · 654 阅读 · 0 评论 -
【数论】ural1091
题目连接 http://acm.timus.ru/problem.aspx?space=1&num=1091原创 2014-10-26 17:06:44 · 532 阅读 · 0 评论 -
Ural1032 (雀巢原理)
1032. Find a MultipleTime limit: 1.0 secondMemory limit: 64 MBThe input contains N positive integers (N ≤ 10000). Each of that numbers is not greater than 15000. This numbers are not neces原创 2014-10-07 20:43:45 · 2344 阅读 · 0 评论 -
poj 3613 矩阵解决最短路
题意:一个无向图,起点终点已知,求恰好走N步的最短路径。这个题nyou原创 2014-09-28 21:53:41 · 664 阅读 · 0 评论 -
poj3233 hdu 1588 (矩阵)
poj3233做其他的题,要用到矩阵求和的东西嘛,然后原创 2014-09-27 21:59:48 · 646 阅读 · 0 评论 -
hdu4549
题意难得的中文字啊。。原创 2014-09-25 21:17:22 · 576 阅读 · 0 评论 -
[排列组合]Codeforces Round #324 (Div. 2)E - Anton and Ira
题意: 给出两个序列p和s,问从p变化到s移动的最小距离是多少。 输出最小距离,移动的次数和移动的点。分析: 逻辑总是感觉很混乱,这里把s的序列重新标号,那么s就是1,2,3,。。n.也就是将p重新标号后的顺序变化成有序递增的序列。这样逻辑上稍微清楚些。然后就是贪心的思想,在将b[k]移动到b[k]的位置的时候所经过的大于b[k]的数都往后移。#includ原创 2015-10-08 11:56:03 · 504 阅读 · 0 评论