随笔分类 -  POJ

poj 2318 TOYS
摘要:==================poj 2318TOYS==================Time Limit:2000MSMemory Limit:65536KTotal Submissions:10660Accepted:5125DescriptionCalculate the numbe... 阅读全文
posted @ 2014-10-14 00:14 lpt 阅读(171) 评论(0) 推荐(0)
poj 3070 Fibonacci
摘要:矩阵快速幂1 while(N)2 {3 if(N&1)4 res=res*A;5 n>>=1;6 A=A*A;7 } 1 #include 2 using namespace std; 3 #deinfe mod 10000 4 struct matrix 5 {... 阅读全文
posted @ 2014-08-12 22:18 lpt 阅读(122) 评论(0) 推荐(0)
poj 2262 Goldbach's Conjecture
摘要:素数判定...很简单= =.....只是因为训练题有,所以顺便更~ 1 #include 2 #include 3 #define maxn 5000005 4 int prime[maxn]; 5 void f() 6 { 7 memset(prime,0,sizeof(prime)); ... 阅读全文
posted @ 2014-07-31 20:06 lpt 阅读(156) 评论(0) 推荐(0)
poj 2377 Bad Cowtractors
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 1100 7 int par[maxn]; 8 int n,m; 9 int len;10 int cnt;11 struct nod... 阅读全文
posted @ 2014-07-31 19:50 lpt 阅读(124) 评论(0) 推荐(0)
poj 1287 Networking
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 1100 7 int par[maxn]; 8 int n,m; 9 int len;10 int cnt;11 struct nod... 阅读全文
posted @ 2014-07-31 19:50 lpt 阅读(120) 评论(0) 推荐(0)
poj 1789 Truck History
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define INF 100 7 #define maxn 2010 8 int dis[maxn][maxn]; 9 int vis[maxn];10 in... 阅读全文
posted @ 2014-07-31 19:49 lpt 阅读(113) 评论(0) 推荐(0)
poj 2349 Arctic Network
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 600 7 int par[maxn]; 8 int pos; 9 int n,cnt,m; 10 double l... 阅读全文
posted @ 2014-07-31 19:49 lpt 阅读(133) 评论(0) 推荐(0)
poj 1258 Agri-Net
摘要:kruskal 1 #include 2 #include 3 #include 4 using namespace std; 5 #define maxn 200 6 int a[maxn][maxn]; 7 int par[maxn]; 8 int n,len; 9 int num;10 str... 阅读全文
posted @ 2014-07-31 00:55 lpt 阅读(118) 评论(0) 推荐(0)
poj 1611 The Suspects
摘要:并查集 简单题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] >= 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(i... 阅读全文
posted @ 2014-07-23 01:06 lpt 阅读(149) 评论(0) 推荐(0)
poj 1129 Channel Allocation
摘要:可以转化为着色模型dfs + 四色定理 1 #include 2 #include 3 int n,num; 4 int d[100][100]; 5 int c[100]; 6 7 bool ok(int step) 8 { 9 for(int i = 0; i = n) return ... 阅读全文
posted @ 2014-07-18 00:22 lpt 阅读(173) 评论(0) 推荐(0)