永夜初晗凝碧天

本博客现已全部转移到新地址,欲获取更多精彩文章,请访问http://acshiryu.github.io/

导航

2011年8月9日 #

poj 2115 同余方程与扩展欧几里德

摘要: a loop which starts by setting variable to value A and while variable is not equal to B, repeats statement followed by increasing the variable by C. We want to know how many times does the statement get executed for particular values of A, B and C, assuming that all arithmetics is calculated in a k-bit unsigned integer type (with values 0 = x 2k) modulo 2k. 阅读全文

posted @ 2011-08-09 10:10 ACShiryu 阅读(471) 评论(0) 推荐(0) 编辑

poj1006 中国剩余定理

摘要: Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentrat 阅读全文

posted @ 2011-08-09 09:52 ACShiryu 阅读(652) 评论(0) 推荐(0) 编辑

2011年8月7日 #

poj3090 欧拉函数与法雷级数

摘要: A 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) does not pass through any other lattice point. For example, the point (4, 2) is not visible since the line from the origin passes through (2, 1). The figure below shows the points (x, y) with 0 ≤ x, y ≤ 5 with lines from the origin to the visible points. 阅读全文

posted @ 2011-08-07 11:35 ACShiryu 阅读(808) 评论(0) 推荐(0) 编辑

poj2478 又一欧拉公式的运用

摘要: The Farey Sequence Fn for any integer n with n = 2 is the set of irreducible rational numbers a/b with 0 a b = n and gcd(a,b) = 1 arranged in increasing order. The first few are F2 = {1/2} F3 = {1/3, 1/2, 2/3} F4 = {1/4, 1/3, 1/2, 2/3, 3/4} F5 = {1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5} You task is to calculate the number of terms in the Farey sequence Fn. 阅读全文

posted @ 2011-08-07 11:17 ACShiryu 阅读(1733) 评论(0) 推荐(0) 编辑

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 the given integer m, find the K-th element which is relatively prime to m when these elements are sorted in ascending order. 阅读全文

posted @ 2011-08-07 11:04 ACShiryu 阅读(1693) 评论(0) 推荐(1) 编辑

2011年8月6日 #

poj 1284 欧拉函数的运用

摘要: We say that integer x, 0 x p, is a primitive root modulo odd prime p if and only if the set { (xi mod p) | 1 = i = p-1 } is equal to { 1, ..., p-1 }. For example, the consecutive powers of 3 modulo 7 are 3, 2, 6, 4, 5, 1, and thus 3 is a primitive root modulo 7. Write a program which given any odd prime 3 = p 65536 outputs the number of primitive roots modulo p. 阅读全文

posted @ 2011-08-06 19:51 ACShiryu 阅读(1792) 评论(1) 推荐(0) 编辑

扩展欧几里德算法 线性同余方程 中国剩余定理

摘要: 欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。其计算原理依赖于下面的定理:   gcd函数就是用来求(a,b)的最大公约数的。   gcd函数的基本性质:   gcd(a,b)=gcd(b,a)=gcd(-a,b)=gcd(|a|,|b|) 阅读全文

posted @ 2011-08-06 16:04 ACShiryu 阅读(894) 评论(0) 推荐(0) 编辑

POJ 2506 高精度+递推

摘要: In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. 阅读全文

posted @ 2011-08-06 15:15 ACShiryu 阅读(1847) 评论(0) 推荐(0) 编辑

2011年8月5日 #

POJ1019 ---简单的数学找规律题

摘要: A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer numbers ranging from 1 to k, written one after another. 阅读全文

posted @ 2011-08-05 20:46 ACShiryu 阅读(2462) 评论(0) 推荐(0) 编辑

POJ2249--一道简单的排列组合题

摘要: Binomial Showdown这一题就是运用了一些简单的排列组合公式,但在做一题时WA了好多次,都是因为在一些细节上没有主要到,刚开始时数据可能会超int,又或者在做除法运算时也可能会结果不精确,递推是会出现RE,不过,最后还是解决了这些问题。 阅读全文

posted @ 2011-08-05 11:24 ACShiryu 阅读(1027) 评论(4) 推荐(1) 编辑

2011年8月4日 #

POJ2407Relatives --欧拉函数的简单运用

摘要: Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a = xy and b = xz. 阅读全文

posted @ 2011-08-04 22:09 ACShiryu 阅读(1439) 评论(1) 推荐(0) 编辑

POJ2262Goldbach's Conjecture 简单的素数判定

摘要: 作者:ACShiryu时间:2011-8-4原题:http://poj.org/problem?id=2262Goldbach's ConjectureTime Limit:1000MSMemory Limit:65536KTotal Submissions:24877Accepted:9798DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Ev 阅读全文

posted @ 2011-08-04 22:00 ACShiryu 阅读(1961) 评论(1) 推荐(0) 编辑

2011年8月3日 #

POJ1142Smith Numbers一道简单的数学题

摘要: 分类:数论作者:ACShiryu时间:2011-8-3原题:http://poj.org/problem?id=1142Smith NumbersTime Limit:1000MSMemory Limit:10000KTotal Submissions:8853Accepted:3105DescriptionWhile skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brothe 阅读全文

posted @ 2011-08-03 22:02 ACShiryu 阅读(1095) 评论(0) 推荐(0) 编辑

通过POJ1061青蛙的约会来谈拓展欧几里德算法

摘要: 分类:数论,扩展欧几里德算法,同余方程作者:ACShiryu时间:2011-8-3原题:http://poj.org/problem?id=1061青蛙的约会Time Limit:1000MSMemory Limit:10000KTotal Submissions:62869Accepted:9818Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某 阅读全文

posted @ 2011-08-03 21:38 ACShiryu 阅读(3446) 评论(3) 推荐(2) 编辑

2011年8月2日 #

POJ 1325 Machine Schedule 解题报告

摘要: 分类:图论,最小覆盖点作者:ACShiryu时间:2011-8-2原题:http://poj.org/problem?id=1325参考资料:Matrix67's BlogMachine ScheduleTime Limit:1000MSMemory Limit:10000KTotal Submissions:7612Accepted:3207DescriptionAs we all know, machine scheduling is a very classical problem in computer science and has been studied for a ve 阅读全文

posted @ 2011-08-02 01:19 ACShiryu 阅读(1335) 评论(3) 推荐(1) 编辑

POJ 1469 COURSES 解题报告

摘要: 分类:图论,最大匹配,二分图作者:ACShiryu时间:2011-8-1原题:http://poj.org/problem?id=1469COURSESTime Limit:1000MSMemory Limit:10000KTotal Submissions:10733Accepted:4204DescriptionConsider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is 阅读全文

posted @ 2011-08-02 00:46 ACShiryu 阅读(803) 评论(0) 推荐(0) 编辑

2011年7月31日 #

POJ 1274 The Perfect Stall 解题报告

摘要: 分类:图论,二分图,最大匹配,匈牙利算法作者:ACShiryu时间:2011-7-31原题:http://poj.org/problem?id=1274资料:Matrix67's Blog; NOCOW匈牙利算法;二分图匹配课件The Perfect StallTime Limit:1000MSMemory Limit:10000KTotal Submissions:11659Accepted:5395DescriptionFarmer John completed his new barn just last week, complete with all the latest mi 阅读全文

posted @ 2011-07-31 17:09 ACShiryu 阅读(1190) 评论(0) 推荐(0) 编辑

2011年7月29日 #

POJ 2485 Highways 解题报告

摘要: 分类:图论,最小生成树作者:ACShiryu时间:2011-7-29原题:http://poj.org/problem?id=2485HighwaysTime Limit:1000MSMemory Limit:65536KTotal Submissions:12754Accepted:5969DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The 阅读全文

posted @ 2011-07-29 21:49 ACShiryu 阅读(1311) 评论(0) 推荐(0) 编辑

POJ 1062 昂贵的聘礼 解题报告

摘要: 分类:图论,最短路作者:ACShiryu时间:2011-7-29原题:http://poj.org/problem?id=1062昂贵的聘礼Time Limit:1000MSMemory Limit:10000KTotal Submissions:21553Accepted:5926Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只 阅读全文

posted @ 2011-07-29 18:06 ACShiryu 阅读(1631) 评论(0) 推荐(0) 编辑

POJ 1251 Jungle Roads 解题报告

摘要: 分类:图论,生成树,Kruskal作者:ACShiryu时间:2011-7-29原题:http://poj.org/problem?id=1251Jungle RoadsTime Limit:1000MSMemory Limit:10000KTotal Submissions:12886Accepted:5760DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between vill 阅读全文

posted @ 2011-07-29 11:34 ACShiryu 阅读(2209) 评论(0) 推荐(0) 编辑