原创 CARDS----置換

題目:http://poj.org/problem?id=1721 題解:p[i]=x[2*i%n] 源代碼: #include <stdio.h> int s,n,k,j,c; int p[1001],x[1001]; int so

原创 Going Home----最小費用流

題目:http://poj.org/problem?id=2195 源代碼:#include <stdio.h> #define INF 1e9 #define MAXN 150 #define N 300 #define M 3000

原创 Prime Distance----篩素數

題目:http://poj.org/problem?id=2689 源代碼:#include <stdio.h> __int64 l,u; int prime[47000]; int prime1[1000100]; int is[47

原创 More Divisors----反素數

題目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1562 題解:g(x)表示x的因子個數。 如果滿足對於任意的0<i<x,有g(i)<g(x),則稱x爲反素數。

原创 青蛙約會----擴展歐幾里得

題目:http://poj.org/problem?id=1061 總結:擴展歐幾里得,ax+by=n,a和b可正可負,求出x可正可負。 求出特解x之後,求最小正整數解。剛剛一開始用的是b,結果WA了。後來發現ax/(a,b)+by/(a

原创 Cipher-----置換

題目:http://poj.org/problem?id=1026     另:http://acm.hdu.edu.cn/showproblem.php?pid=1439 題解:求出經過k次置換後,str[i]的位置。 代碼:#incl

原创 Digital Root----code forces

題目:http://codeforces.com/problemset/problem/10/C 題意:就是在【1,N】的範圍內,找出有多少對A B C,使得A*B !=C&&d(A*B)==d(C). 解:其實d(x)=x%9,用(a*

原创 Period of an Infinite Binary Expansion-----歐拉函數,歐拉定理

題目:http://poj.org/problem?id=3358 這一題很經典。 題解:源於http://www.cnblogs.com/ACKO

原创 Strange Way to Express Integers-----不互質的中國剩餘定理

參考文章地址:http://blog.csdn.net/hqd_acm/article/details/6173859 題目:http://poj.org/problem?id=2891 思路: x=r1 (mod a1) x=r2

原创 LCA----最近公共祖先

推薦博客:http://kmplayer.iteye.com/blog/604518 poj  1330 源代碼: #include <stdio.h> #include <vector> #define MAXN 10005 using

原创 And Then There Was One----約瑟夫環

題目:http://poj.org/problem?id=3517 參考文章:約瑟夫環百度百科:http://baike.baidu.com/view/717633.htm 注:這裏的編號都是從0到n-1的。 n是總人數,k是報k的人出列

原创 快速求解歐拉函數

源代碼:void get() { for(int i=2;i<1001000;i++){ num[i]=1; euler

原创 miller_rabin

證明:http://download.csdn.net/my 源代碼:#include <stdio.h> #include <stdlib.h>

原创 Greedy Change

題目:http://codeforces.com/problemset/problem/10/E 源代碼:#include <stdio.h> int n; int data[500]; int ans; void solve() {

原创 湖南衛視 直播

鏈接地址:http://blog.sina.com.cn/s/blog_9de6b8ab0101409p.html 點贊 收藏