
Mathematics
文章平均质量分 67
X-Wyatt
For free 邮箱whitezhangv5@gmail.com
展开
-
UVa 10303
catalan数:令h(0)=1,h(1)=1,catalan数满足递推式h(n)= h(0)*h(n-1)+h(1)*h(n-2) + ... + h(n-1)h(0) (n>=2) 例如:h(2)=h(0)*h(1)+h(1)*h(0)=1*1+1*1=2 h(3)=h(0)*h(2)+h(1)*h(1)+h(2)*h(0)=1*2+1*1+2*1=5 另类递推式原创 2012-10-11 01:52:15 · 574 阅读 · 0 评论 -
由倒水问题引发出来的对于模线性方程与二元不定方程的思考
今天下课的时候,拿同学手机玩了会游戏,不过很巧,玩的是个倒水的游戏。具体是这样的,相信大家肯定都玩过:给你两个已知容量的杯子,然后要求在某个杯子中得出指定容量的水。1、两个杯子分别为7L和4L,然后要倒出一升的水:求解这样的问题,其实就是求解二元不定方程:7x+4y = 1很容易解得 x = -1, y = 2。因为7和4互质,gcd(7,4) = 1,然后再用扩展欧几原创 2013-09-03 20:51:59 · 1532 阅读 · 0 评论 -
ZOJ 1136
广搜,每个节点有两个值,一个是当前的数字,另一个是余数,用余数可以减少以后的计算量,并且可进行剪枝,从而减少了常数时间的复杂度#include #include #include #include #include using namespace std;struct Node { string num; int mod; Node() {} Node(stri原创 2013-07-16 10:36:19 · 1263 阅读 · 0 评论 -
HDU 1290
其实就是个数学题,解方程的系数即可二维平面的一般方程都是an^2+bn+c,而三维平面的方程一般都是an^3+bn^2+cn+d这里给了三个数据,自己在创立一个数据即可,输入为4,结果为15求的系数,解出方程#include #include using namespace std;int main() { int a, ans; while(scanf("%原创 2013-01-25 15:52:49 · 964 阅读 · 0 评论 -
HDU 1098
一道关于取模运算的数学题,推倒出公式即可:一开始把num数组放在了栈空间里面,并且对于index下标没有做溢出判断,从而使得k变为了47,让我很不解,后来发现是数组溢出覆盖了。#include #include #include using namespace std;#define LEN 10000int num[LEN];int main() { int a,原创 2012-12-11 11:15:38 · 589 阅读 · 0 评论 -
鸽巢原理以及Ramsey定理详解
简单形式:定理:如果有n+1个物体被放进n个盒子,那么至少有一个和紫包含两个或者更多的物体。 定理非常的简单,但是真正用好这个定理却需要一定的功底。eg1.以为国际象棋大师有11周的时间备战一场锦标赛,他决定每天至少下一盘国际象棋,但是为了不使自己过于疲劳,他还决定在每周不能下超过12盘。证明存在连续若干天,期间这位大师恰好下了21盘棋。证明:鸽巢原理的应用最终就是要找到物原创 2012-11-10 21:53:15 · 7044 阅读 · 4 评论 -
Project Euler-3(素数问题)
Problem:The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?I print the prime number first and my codes are as follows:#includ原创 2012-09-11 19:00:26 · 508 阅读 · 0 评论 -
Project Euler-5
Problem:2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the nu原创 2012-09-11 20:45:55 · 435 阅读 · 0 评论 -
Project Euler-6
Problem:The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)2 = 552 = 3025He原创 2012-09-11 21:05:07 · 381 阅读 · 0 评论 -
HDU 1028
母函数#include #include #include using namespace std;int c1[400], c2[400];int main() { int n; while(scanf("%d", &n) != EOF) { int i, j, k; for(i = 0; i < 400; i++) { c1[i] = 1; c2[i原创 2014-04-12 10:51:21 · 834 阅读 · 0 评论