随笔分类 -  数学

1
Rectangle and Square(判断正方形、矩形)
摘要:http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=42#problem/D改了N多次之后终于A了,一直在改判断正方形和矩形那,判断正方形时算出六条边再排序,若前四条边相等并且与后两条边满足勾股定理,说明是正方形,判断矩形时,我先对结构体二级排序,这样四个点有确定的顺序,再用点积判断是否有三个角是直角,是的话就是矩形。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct node 7 { 8 int x,y; 9 }po... 阅读全文
posted @ 2013-11-10 20:38 straw_berry 阅读(440) 评论(0) 推荐(0)
France \'98(概率)
摘要:题目描述Today the first round of the Soccer World Championship in France is coming to an end. 16 countries are remaining now, among which the winner is determined by the following tournament: 1 Brazil -----+ +-- ? --+ 2 Chile ------+ | +-- ? --+ 3 Nigeria ----+ | | ... 阅读全文
posted @ 2013-11-03 21:32 straw_berry 阅读(263) 评论(0) 推荐(0)
GCC
摘要:题目描述The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by theGNU Project supporting various programming languages. But it doesn’t contains the math operator “!”.In mathematics the symbol represents the factorial operation. The expression n! means "theproduct of 阅读全文
posted @ 2013-11-03 21:26 straw_berry 阅读(191) 评论(0) 推荐(0)
Tribles(概率)
摘要:DescriptionProblemATribblesInput:Standard InputOutput:Standard OutputGRAVITATION,n."The tendency of all bodies to approach one another with a strengthproportion to the quantity of matter they contain -- the quantity ofmatter they contain being ascertained by the strength of their tendencyto app 阅读全文
posted @ 2013-11-03 19:29 straw_berry 阅读(317) 评论(0) 推荐(0)
Wall(Graham算法)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:27110Accepted:9045DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beaut 阅读全文
posted @ 2013-10-26 16:18 straw_berry 阅读(313) 评论(0) 推荐(0)
Beauty Contest(graham求凸包算法)
摘要:Time Limit:3000MSMemory Limit:65536KTotal Submissions:25256Accepted:7756DescriptionBessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 2 #include 3 #include 4 #include 5 usi 阅读全文
posted @ 2013-10-25 20:53 straw_berry 阅读(179) 评论(0) 推荐(0)
A Round Peg in a Ground Hole(判断是否是凸包,点是否在凸包内,圆与多边形的关系)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:4628Accepted:1434DescriptionThe DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden peg that fits into pre-cut holes in each piece to be attached. The 阅读全文
posted @ 2013-10-25 17:35 straw_berry 阅读(372) 评论(0) 推荐(0)
Fishnet(计算几何)
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:1642Accepted:1051DescriptionA fisherman named Etadokah awoke in a very small island. He could see calm, beautiful and blue sea around the island. The previous night he had encountered a terrible storm and had reached this uninhabited island. Some 阅读全文
posted @ 2013-10-24 16:33 straw_berry 阅读(362) 评论(0) 推荐(0)
Pick-up sticks(判断两条线段是否相交)
摘要:Time Limit:3000MSMemory Limit:65536KTotal Submissions:8351Accepted:3068DescriptionStan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there is no stick on top of th 阅读全文
posted @ 2013-10-20 20:06 straw_berry 阅读(256) 评论(0) 推荐(0)
poj 1265 Area(pick定理)
摘要:AreaTime Limit:1000MSMemory Limit:10000KTotal Submissions:4373Accepted:1983DescriptionBeing well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new research and development facility the company has installed the latest 阅读全文
posted @ 2013-10-20 14:57 straw_berry 阅读(186) 评论(0) 推荐(0)
Strange Way to Express Integers (一般模线性方程组)
摘要:Time Limit:1000MSMemory Limit:131072KTotal Submissions:8476Accepted:2554DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choosekdifferent positive integersa1,a2,…,ak. For some non-negativem, di 阅读全文
posted @ 2013-10-15 18:57 straw_berry 阅读(221) 评论(0) 推荐(0)
生理周期
摘要:http://poj.org/problem?id=1006中国剩余定理模板题 1 #include 2 #include 3 int p,e,i,d; 4 int a[5],m[5]; 5 int item = 1; 6 int extend_gcd(int a,int b,int &x,int &y) 7 { 8 if(b == 0) 9 {10 x = 1;11 y = 0;12 return a;13 }14 else15 {16 int r = extend_gcd(b,a%b,x... 阅读全文
posted @ 2013-10-14 19:55 straw_berry 阅读(161) 评论(0) 推荐(0)
C Looooops(扩展欧几里得求模线性方程)
摘要:http://poj.org/problem?id=2115题意:对于C的循环(for i = A; i != B; i+=C)问在k位存储系统内循环多少次结束; 若循环有限次能结束输出次数,否则输出FOREVER;解:设x为循环次数; (A+C*x)%2^k = B; 则 C*x+A = 2^k*y+B; 所以 C*x - 2^k*y = B-A; 类似于a*x+b*y = c (或 a*x = c(mod b))模线性方程的形式,所以可以根据扩展欧几里得算法解决 1 #include 2 #include 3 4 long long exGcd(long long a,... 阅读全文
posted @ 2013-10-12 21:56 straw_berry 阅读(211) 评论(0) 推荐(0)
Sumdiv(各种数学)
摘要:http://poj.org/problem?id=1845题意:求A^B的所有约数的和再对9901取模;做了这个学到了N多数学知识;一:任意一个整数都可以唯一分解成素因子的乘积;A = p1^k1*p2^k2*......*pn^kn; A先对2不断取模,当A%2==0时,2的次数加1,直到A%2!=0,A再尝试着对3不断取模.....依次进行下去,直到A = 1; 当A本身就是素数时,A^1就是素数本身的分解式(特殊情况,别忘了加判断); 这样A^B = p1^(k1*B) * p2(k2*B) * .......*pn^(kn*B);二:一个数用素因子乘积表示后其约数和公式; A... 阅读全文
posted @ 2013-10-12 20:14 straw_berry 阅读(776) 评论(0) 推荐(0)
The Embarrassed Cryptographer(高精度取模+同余模定理)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:11435Accepted:3040DescriptionThe young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic keys are created from the produc 阅读全文
posted @ 2013-10-08 21:04 straw_berry 阅读(381) 评论(0) 推荐(0)
Paths on a Grid
摘要:http://poj.org/problem?id=1942题意:一个n*m的格子,从左下角走到右上角有多少种走法,规定只能向上或向右走;思路:解法挺水的,高中学组合数的时候老师给讲过;求C[m+n][n]就可以; 但是这里n,m是32位以内的数,要用double,输出的时候只输出整数部分; 1 #include 2 #include 3 using namespace std; 4 5 double n,m,ans; 6 int main() 7 { 8 cout>n>>m)10 {11 if(n == 0 && m == 0)12 ... 阅读全文
posted @ 2013-09-28 09:47 straw_berry 阅读(171) 评论(0) 推荐(0)
Number Sequence
摘要:Time Limit:1000MSMemory Limit:10000KTotal Submissions:31455Accepted:8924DescriptionA 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 fr 阅读全文
posted @ 2013-09-19 00:49 straw_berry 阅读(216) 评论(0) 推荐(0)
Code (组合数)
摘要:Time Limit:1000MSMemory Limit:30000KTotal Submissions:7184Accepted:3353DescriptionTransmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequence. It 阅读全文
posted @ 2013-09-17 20:42 straw_berry 阅读(263) 评论(0) 推荐(0)
Round Numbers (排列组合)
摘要:Time Limit:2000MSMemory Limit:65536KTotal Submissions:7558Accepted:2596DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) in order to ma 阅读全文
posted @ 2013-09-13 20:03 straw_berry 阅读(295) 评论(0) 推荐(0)
Naive and Silly Muggles (计算几何)
摘要:Naive and Silly MugglesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 137Accepted Submission(s): 94Problem DescriptionThree wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, whic 阅读全文
posted @ 2013-09-11 22:23 straw_berry 阅读(319) 评论(0) 推荐(0)

1