- 博客(143)
- 资源 (5)
- 收藏
- 关注

原创 数学小知识&总结索引(持续更新)
11、判断组合数C(n,m)的奇偶性有一个我也不知道证明的方法当n&m==m为奇数,反之就是偶数计算几何题目推荐.数学小知识:拉姆齐定理 - 维基百科 : 离散数学老师将过一个一个小例子.六个人中必定有三个人互相认识或者不认识,调和级数求和公式 - 维基百科: Sn=ln(n+1)+C=ln(n)+C−1.0/(n∗2)S_n = ln(n+1) + C = ln(n) + C - 1.0 /
2017-08-19 18:50:21
453
原创 Another Easy Problem FZU - 1753唯一分解定理
题目链接小TT最近学习了高斯消元法解方程组,现在他的问题来了,如果是以下的方程,那么应该如何解呢?C(n1,m1)==0 (mod M)C(n2,m2)==0 (mod M)C(n3,m3)==0 (mod M)................C(nk,mk)==0 (mod M)小TT希望你告诉他满足条件的最大的M其中C(i,j)表示组合数,例如C(5,2)=10,C(4,2)=6...Inpu
2017-09-29 21:23:32
455
原创 Divisors POJ - 2992
题目链接Your 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 several instanc
2017-09-29 20:54:16
670
原创 Period of an Infinite Binary Expansion POJ - 3358 欧拉函数
题目链接Let {x} = 0.a1a2a3... be the binary representation of the fractional part of a rational number z. Suppose that {x} is periodic then, we can write{x} = 0.a1a2...ar(ar+1ar+2...ar+s)wfor some integers
2017-09-28 23:24:13
519
原创 Happy 2006 POJ - 2773 数论
题目链接Two positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relatively prime to 2006.Now your job is easy: for
2017-09-28 23:13:44
372
原创 Coin 2017 西安网络赛 快速幂 + 二项式定理
题目链接Bob has a not even coin, every time he tosses the coin, the probability that the coin’s front face up is qp(qp≤12)qp(qp≤12)pq(pq≤21).qp(qp≤12)\frac{q}{p}(\frac{q}{p} \le \frac{1}{2})
2017-09-16 18:45:08
369
原创 number number number hdu 6189 矩阵快速幂
题目链接We define a sequence F:⋅ F0=0,F1=1;⋅ Fn=Fn−1+Fn−2 (n≥2).Give you an integer k, if a positive number n can be expressed byn=Fa1+Fa2+...+Fak where 0≤a1≤a2≤⋯≤ak, this positive number is mjf−good. Ot
2017-09-10 19:44:01
479
原创 Snakes and Ladders LightOJ - 1151 概率dp + 高斯消元
题目链接'Snakes and Ladders' or 'Shap-Ludu' is a game commonly played in Bangladesh. The game is so common that it would be tough to find a person who hasn't played it. But those who haven't played it (unl
2017-09-07 19:14:50
811
原创 More Divisors ZOJ - 2562 反素数
题目链接Everybody knows that we use decimal notation, i.e. the base of our notation is 10. Historians say that it is so because men have ten fingers. Maybe they are right. However, this is often not very c
2017-09-02 13:33:52
394
原创 Primitive Roots POJ - 1284 原根, 欧拉函数
题目链接We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (x^i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, the consecutive powers of 3
2017-09-02 09:20:40
418
原创 Nice Milk POJ - 1271 UVA 10117 半平面相交
题目链接: POJ1271 , UVa 10117 Little Tomy likes to cover his bread with some milk. He does this by putting it in the cup so that one of its sides (called bottom side) touches the bottom of the cup, just as the pi
2017-09-01 14:51:37
629
原创 GCD & LCM Inverse POJ - 2429 Pollard_rho大数因子分解
题目链接Given two positive integers a and b, we can easily calculate the greatest common divisor (GCD) and the least common multiple (LCM) of a and b. But what about the inverse? That is: given GCD and LCM
2017-08-25 11:53:47
587
原创 Prime Test POJ - 1811 miller素数判断&pollar_rho大数分解
题目链接Given a big integer number, you are required to find out whether it's a prime number. InputThe first line contains the number of test cases T (1 <= T <= 20 ), then the following T lines each conta
2017-08-25 11:09:58
766
原创 Prime Distance POJ - 2689素数筛法
题目链接The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of prim
2017-08-25 10:23:45
423
原创 Magic Bracelet POJ - 2888 Burnside引理+数论+DP矩阵优化
题目链接Ginny’s birthday is coming soon. Harry Potter is preparing a birthday present for his new girlfriend. The present is a magic bracelet which consists of n magic beads. The are m kinds of different m
2017-08-25 10:10:10
604
原创 Necklace of Beads POJ - 1286 polya定理
题目链接Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace
2017-08-24 21:15:46
405
原创 Color POJ - 2154 polya定理 + 欧拉优化
[题目链接](http://poj.org/problem?id=2154)Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can
2017-08-24 21:06:42
421
原创 Let it Bead POJ - 2409 Polya定理
[题目链接](http://poj.org/problem?id=2409)"Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department
2017-08-24 20:24:20
487
原创 Function HDU - 6038
[题目链接](http://acm.hdu.edu.cn/showproblem.php?pid=6038)You are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1.Define that the domain of function f is the set of integers from 0 to
2017-08-24 10:45:49
402
原创 Balala Power! HDU - 6034 贪心
题目链接Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number ranged from 0
2017-08-24 10:05:13
478
原创 ZOJ 3687 The Review Plan I 禁位排列 | 容斥原理
题目链接 Michael takes the Discrete Mathematics course in this semester. Now it's close to the final exam, and he wants to take a complete review of this course.The whole book he needs to review has N chap
2017-08-24 09:33:52
747
原创 ZOJ 3574 Under Attack II 归并排序求逆序对
题目链接 Because of the sucessfully calculation in Under Attack I, Doctor is awarded with Courage Cross and promoted to lieutenant. But the war seems to end in never, now Doctor has a new order to help ant
2017-08-24 09:14:03
259
原创 Connected Graph POJ1737 高精度
题目链接An undirected graph is a set V of vertices and a set of E∈{V*V} edges.An undirected graph is connected if and only if for every pair (u,v) of vertices,u is reachable from v.You are to write a prog
2017-08-24 09:06:11
295
原创 Special Special Judge III ZOJ - 3413
题目链接 Because of recent update of ZOJ, some special judges were broken. You're requested to fix the special judge for Problem 9999.In Problem 9999, there is only one case in where the standard output is
2017-08-24 08:33:07
401
原创 NUMBER BASE CONVERSION POJ 1220 进制转换模板
题目链接Write a program to convert numbers in one base to numbers in a second base. There are 62 different digits:{ 0-9,A-Z,a-z }HINT: If you make a sequence of base conversions using the output of one c
2017-08-23 20:48:41
297
原创 Count Squares HDU 3432
题目链接:Given a set of points with integer coordinates xi, yi, i = 1...N, your program must find all the squares having each of four vertices in one of these points.InputInput file contains integer N fol
2017-08-23 20:40:00
319
原创 M斐波那契数列 HDU - 4549 矩阵快速幂
题目链接 M斐波那契数列F[n]是一种整数数列,它的定义如下:F[0] = aF[1] = bF[n] = F[n-1] * F[n-2] ( n > 1 )现在给出a, b, n,你能求出F[n]的值吗? Input输入包含多组测试数据;每组数据占一行,包含3个整数a, b, n( 0 <= a, b, n <= 10^9 )Output对每组测试数据请输出一个整数F[n],由于F[n]
2017-08-23 19:35:38
397
原创 How Many Calls? UVA - 10518 矩阵快速幂
题目链接: 点我题意:给你fibonacci数列怎么求的,然后问你求f(n) = f(n - 1) + f(n - 2)需要多少次调用,并且这个数很大,取模一个进制的数。思路:我们要知道调用次数F(n) = f(n)* 2 - 1这个规律,那么这题就可以解了,矩阵快速幂跑一边即可.代码:#include<cstdio>#include<cstring>#include<iostream>#in
2017-08-23 19:10:11
289
原创 Construct a Matrix FZU - 1911 矩阵快速幂
题目链接:点我 There is a set of matrixes that are constructed subject to the following constraints:1. The matrix is a S(n)×S(n) matrix;2. S(n) is the sum of the first n Fibonacci numbers modulus m,
2017-08-23 19:05:17
292
转载 ACM计算几何题目推荐
一。点,线,面,形基本关系,点积叉积的理解POJ 2318 TOYS(推荐) http://acm.pku.edu.cn/JudgeOnline/problem?id=2318 POJ 2398 Toy Storage(推荐) http://acm.pku.edu.cn/JudgeOnline/problem?id=2398 一个矩形,有被若干直线分成N个格子,给出一个点的坐标,问你该点位于
2017-08-23 11:13:13
1862
原创 Bear in the Field CodeForces - 385E 矩阵快速幂
题目链接:点我Our bear's forest has a checkered field. The checkered field is an n × n table, the rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. Let
2017-08-19 09:52:38
306
原创 Yet Another Number Sequence CodeForces - 392C 矩阵快速幂
题目链接:点我Everyone knows what the Fibonacci sequence is. This sequence can be defined by the recurrence relation:F1 = 1, F2 = 2, Fi = Fi - 1 + Fi - 2 (i > 2).We'll define a new number sequence Ai(
2017-08-19 09:30:54
422
原创 So Easy! HDU - 4565 矩阵快速幂
题目链接:点我 A sequence S n is defined as: Where a, b, n, m are positive integers.┌x┐is the ceil of x. For example, ┌3.14┐=4. You are to calculate S n. You, a top coder, say: So easy! Input There are
2017-08-18 22:27:32
601
原创 Number of Battlefields UVA - 11885 矩阵快速幂
题目链接:点我题意:给周长,求能围成的战场数目,不包括矩形。思路:矩阵快速幂; 如果包含矩形的话,对应的则是斐波那契数列的偶数项,所以对应减去矩形的个数即可代码:#include<cstdio>#include<cstring>#include<cmath>#include<iostream>#include<algorithm>using namespace std;typedef l
2017-08-18 21:57:28
431
原创 Recurrences UVA - 10870 矩阵快速幂
题目链接:点我题意:如题给出的公式,让你求 f(n) mod m的值;思路:矩阵快速幂; 根据题意构造矩阵为: ⎛⎝⎜⎜⎜⎜⎜⎜a110.....a201.......a300.......a400....0................1ad00...0⎞⎠⎟⎟⎟⎟⎟⎟\begin{pmatrix} a_1 & a_2 & a_3 & a_4 &.... & a_d\\1 & 0 & 0
2017-08-18 21:47:44
257
原创 Cellular Automaton UVA - 1386 矩阵快速幂 & 循环矩阵
题目链接:点我题意:一个细胞自动机,有n个格子,每个格子的取值为0~m-1。给定距离d,每次操作后每个格子的值将变为到它距离不超过d的所有格子在操作之前的值之和除以m的余数。思路:循环矩阵,矩阵快速幂; 我们可以发现,如果开一个500 * 500 的矩阵程序会直接崩掉,不能运行,于是就开始找规律,回来发现这是一个循环矩阵(维基百科),那么根据维基百科上给出的循环矩阵的性质,这题就可以解了, ps
2017-08-18 21:37:26
276
原创 Contemplation! Algebra UVA - 10655 矩阵快速幂
题目链接:点我题意:给你a + b 和 a * b 让你计算 an a ^{n} + bn b ^{n} 思路:矩阵快速幂. 刚开始看见这个式子我也是懵逼的,后来就想,看看能不能找规律,于是自己手写了几项, 发现还是真的有一部份规律. an a^{n} + bnb^{n} =(an−1 a^{n - 1} + bn−1b^{n - 1}) * ( a + b - a * b ) ,突然发现自己乱写
2017-08-18 20:32:58
238
原创 Power of Matrix UVA - 11149(矩阵倍增)
题目链接:点我题意:给你一个矩阵 A, 让你求 A + A2A^{2} + A3A^{3} + A4A^{4} + A5A^{5} + …. AnA^{n},思路:矩阵倍增,那么怎么倍增呢, 令矩阵 S = A + A2A^{2} + A3A^{3} + A4A^{4} + A5A^{5} + … AnA^{n} = A + A2A^{2} + A3A^{3} + A4A^{4} + A5A^{
2017-08-18 20:19:56
300
原创 Yet another Number Sequence UVA - 10689 (矩阵快速幂)
题目链接:点我题意:求f(n) mod m 的值,思路:类似与求斐波那契数列(Fibonacci)数列的第n项那样,快速幂即可. 构造递推矩阵为:(1110) \begin{pmatrix} 1 & 1 \\ 1 & 0\end{pmatrix}代码:#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#
2017-08-18 20:07:20
287
原创 Experienced Endeavour UVA - 11551 (矩阵快速幂)
题目链接:点我题意:给定一列数,每个数对应一个变换,变换为原先数列一些位置相加起来的和,问r次变换后的序列是多少.思路:矩阵快速幂,将需要变换的位置变为1, 其他的都为0, 然后快速幂跑R次即可.代码:#include<cstdio>#include<algorithm>#include<cstring>#include<iostream>#include<cmath>using name
2017-08-18 20:01:57
292
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人