摘要:
C. Learning Languages今天恰好学了图论中的最小生成树和prim还有克鲁丝卡尔,其中提到了并查集,下面是CF上的一个例子,恰好使用了并查集,这个是别人的代码,当时并不知道这个是什么意思,怎么用,现在看来,任何算法都需要先学习后才能看懂人家的代码,以后才能学会使用。其中fa[]数组起到的作用就是连接两个集合;// File Name: 170c.cpp
// Author: rudolf
// Created Time: 2013年03月04日 星期一 16:19:34 #include<vector>
#include<list>
#include&l 阅读全文
posted @ 2013-04-16 19:21
bo_jwolf
阅读(181)
评论(0)
推荐(0)
摘要:
hdu 2131
View Code 复制代码 #include<stdio.h>
#include<string.h>
int main()
{ char ch[2],s[210]; while(scanf("%s %s",ch,s)!=EOF) { char x = ch[0]; int len = strlen(s); int cnt = 0; if( x >= 'A' && x <= 'Z' ) { for(int i ... 阅读全文
posted @ 2013-04-16 16:26
bo_jwolf
阅读(167)
评论(0)
推荐(0)
浙公网安备 33010602011771号