- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 poj 3259 Wormholes
Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination a
2016-11-26 19:47:10 206
原创 扩展欧几里得算法理解
这段时间在刷一套关于扩展欧几里得算法的题目,现在做一下总结: 对于不完全为 0 的非负整数 a,b,gcd(a,b)表示 a,b 的最大公约数,必然存在整数对 x,y ,使得 gcd(a,b)=ax+by。 证明:设 a>b。 1,显然当 b=0,gcd(a,b)=a。此时 x=1,y=0; 2,ab!=0 时 设 ax1+by1=gc
2016-11-17 20:30:51 523
原创 HDU 2669 Romantic
Problem Description The Sky is Sprite. The Birds is Fly in the Sky. The Wind is Wonderful. Blew Throw the Trees Trees are Shaking, Leaves are Falling. Lovers Walk passing, and so are You. ..
2016-11-16 18:41:08 191
原创 POJ 1061 青蛙的约会
Description 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面
2016-11-16 08:58:30 177
原创 POJ 2115 C Looooops
Description A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement; I.e., a loop which starts by setting variable to
2016-11-16 08:52:01 203
转载 差分约束系统转化成最短路
转自:http://www.cnblogs.com/void/archive/2011/08/26/2153928.html 差分约束系统中: 如果求未知数的最大值,那么按小于等于建图后求最短路即可。(因为求最短路是由无穷向下约束而得到的,所以得到的一定是最大值)。 如果求未知数的最小值,那么按小于等于建图后求最长路即可。 注意所有数
2016-11-11 16:45:54 157
原创 poj 1201 Intervals
Description You are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn. Write a program that: reads the number of intervals, their end points and integers c1, ..., cn from th
2016-11-11 12:16:02 171
原创 poj 1364 King
Description Once, in one kingdom, there was a queen and that queen was expecting a baby. The queen prayed: ``If my child was a son and if only he was a sound king.'' After nine months her child was
2016-11-11 12:12:46 184
原创 常用小方法整理(2)
欧拉函数整理,能够快速计算与n互质的或者叫互素的数字个数,利用的是容斥原理 int eular(int n) { int ans=1,i; for (i=2;i*i<=n;i++) if (n%i==0) //(1) { n/=i; ans*=(i-1);
2016-11-01 22:22:02 273
原创 hdu 1052 Tian Ji -- The Horse Racing
Problem Description Here is a famous story in Chinese history. "That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king
2016-11-01 15:09:28 153
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人