• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Siriuslzx

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2012年8月20日

poj - 2513 Colored Sticks
摘要: Tire + 并查集 + Eular回路,花了老长时间呢。 1 #include <stdio.h> 2 #include <string.h> 3 const int N = 500050; 4 int next[5*N][26],d[5*N],cnt=0; 5 int fa[N],col[N],D[N],color=0; 6 int inst(char *t) 7 { 8 int u = 0,idx; 9 while(*t)10 {11 idx = *t -'a';12 if(!next[u][idx])13 {14 ... 阅读全文
posted @ 2012-08-20 17:02 Siriuslzx 阅读(133) 评论(0) 推荐(0)
 
poj - 2418 Hardwood Species
摘要: 二叉排序树,第一次做的时候状态不好,就放弃了,现在一看,怎么这么简单? 1 #include <stdio.h> 2 #include <string.h> 3 struct Node 4 { 5 char name[40]; 6 int d,lc,rc; 7 void init(char *t) 8 { 9 strcpy(name,t);10 lc = rc = 0;11 d = 1;12 }13 }a[10050];14 int cnt = 1,num=0;15 void inst(char *s, i... 阅读全文
posted @ 2012-08-20 16:58 Siriuslzx 阅读(158) 评论(0) 推荐(0)
 
poj - 1521 Entropy
摘要: Huffman的题,基本都是用pq水过。今天我才知道,计算压缩后编码总长度,只要用加的方法就行了。 1 #include <stdio.h> 2 #include <string.h> 3 #include <queue> 4 using namespace std; 5 int main() 6 { 7 char ss[1000]; 8 int i,l,n,a,b; 9 int d[40];10 while(scanf("%s",ss),strcmp(ss,"END"))11 {12 memset(d,0,sizeo 阅读全文
posted @ 2012-08-20 16:55 Siriuslzx 阅读(162) 评论(0) 推荐(0)