2008年7月5日

摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/*扩展欧几里德求模线性方程感谢logic_space的指正*/#include#defineabs(a)((a)<0?-(a):(a))usingnamespacestd;__int64exGCD(__int64a,__int64b,__int64&x,__int64&y){if(b==0){x=1;y=0;returna;}__int64r=exGCD(b,a%b,x, 阅读全文
posted @ 2008-07-05 21:26 三鲜 阅读(2026) 评论(4) 推荐(0)
 
摘要: #include #define MAXN 100001using namespace std;int OP[MAXN][3];int JUMP[MAXN];int COLOR[MAXN];int main(){ int cas, ans, n, q, temp; int i, j, k; scanf("%d", &cas); for (j = 1; j = 0; ... 阅读全文
posted @ 2008-07-05 20:07 三鲜 阅读(507) 评论(1) 推荐(0)
 
摘要: #include using namespace std; struct type1 { int parent; int rank; } FOOD[50001]; int find(int i) { int t = FOOD[i].parent; if (t n || y > n) lie++; else if (d... 阅读全文
posted @ 2008-07-05 18:22 三鲜 阅读(1346) 评论(1) 推荐(0)
 
摘要: #include #define MAXN 10001 using namespace std; int JUMP[MAXN]; int cmp(const void *a, const void *b) { return ((int *)b)[0] - ((int *)a)[0]; } int find(int x) /* 查找包含接点x的集合的根节点 */ { ... 阅读全文
posted @ 2008-07-05 18:10 三鲜 阅读(639) 评论(0) 推荐(0)