摘要:
#include<stdio.h>int bin[1001];int find(int x){ int t=x; while(bin[t]!=t) t=bin[t]; return t;}void insert(int x,int y){ int fx,fy; fx=find(x); fy=find(y); if(fx!=fy) bin[fx]=fy;}int main(){ int n,m,a,b,i,sum; while(scanf("%d",&n),n) { for(i=0;i<=n;+... 阅读全文
posted @ 2012-08-13 18:00
煮人为乐
阅读(148)
评论(0)
推荐(0)
摘要:
这个题原来没有思路,感觉较难,想着得建树,后来在讨论区看到神贴,用set水过,看了一下,才想到方法,其实这个不用set的巧妙之处是 运用了set 相同的元素只存储一个的特性,建立两个容器,好啦,大家一看代码便知思路,我暴怒废话啦#include<iostream>#include<set>#include<string>#include<algorithm> //这个不能少,用到比较时旧的添上using namespace std;int main(){ int n; string str1,str2; set<string>a,b; 阅读全文
posted @ 2012-08-13 10:21
煮人为乐
阅读(224)
评论(0)
推荐(0)
摘要:
没啥好说的,比较简单,就是注意一些特殊的提放就行啦/* 功能Function Description: HDOJ_2574 开发环境Environment: vc6.0 技术特点Technique: 版本Version: 作者Author: jzjz 日期Date: 20120813 备注Notes: 题目大意是 找出女生编号中,包含素数种类最多的(不是个数),如果两个相同,找出字典数小的,输出名字 */#include<stdio.h>#includ... 阅读全文
posted @ 2012-08-13 09:26
煮人为乐
阅读(201)
评论(0)
推荐(0)

浙公网安备 33010602011771号