原创 Experienced Endeavour UVA - 11551 (矩陣快速冪)
題目鏈接:點我 題意: 給定一列數,每個數對應一個變換,變換爲原先數列一些位置相加起來的和,問r次變換後的序列是多少. 思路: 矩陣快速冪,將需要變換的位置變爲1, 其他的都爲0, 然後快速冪跑R次即可. 代碼: #includ
原创 Contemplation! Algebra UVA - 10655 矩陣快速冪
題目鏈接:點我 題意: 給你a + b 和 a * b 讓你計算 an + bn 思路: 矩陣快速冪. 剛開始看見這個式子我也是懵逼的,後來就想,看看能不能找規律,於是自己手寫了幾項, 發現還是真的有一部份規律. an
原创 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
原创 Yet another Number Sequence UVA - 10689 (矩陣快速冪)
題目鏈接:點我 題意: 求f(n) mod m 的值, 思路: 類似與求斐波那契數列(Fibonacci)數列的第n項那樣,快速冪即可. 構造遞推矩陣爲:(1110) 代碼: #include<cstdio> #include
原创 How Many Calls? UVA - 10518 矩陣快速冪
題目鏈接: 點我 題意: 給你fibonacci數列怎麼求的,然後問你求f(n) = f(n - 1) + f(n - 2)需要多少次調用,並且這個數很大,取模一個進制的數。 思路: 我們要知道調用次數F(n) = f(n)*
原创 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
原创 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
原创 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 b
原创 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
原创 Nice Milk POJ - 1271 UVA 10117 半平面相交
題目鏈接: POJ , UVa Little Tomy likes to cover his bread with some milk. He does this by putting it in the cup so that
原创 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
原创 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
原创 數學小知識&總結索引(持續更新)
計算幾何題目推薦. 數學小知識: 拉姆齊定理 - 維基百科 : 離散數學老師將過一個一個小例子.六個人中必定有三個人互相認識或者不認識, 調和級數求和公式 - 維基百科: Sn=ln(n+1)+C=ln(n)+C−1.0/(n∗2)
原创 Prime Distance POJ - 2689素數篩法
題目鏈接 The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured
原创 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 comm