E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Religions
POJ 2524 并查集
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-11-11 13:26
poj
poj 2524:Ubiquitous
Religions
(并查集,入门题)
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-11-11 11:31
poj
POJ 2524 Ubiquitous
Religions
(并查集)
题目链接 赤裸裸的并查集,搞不懂为什么POJ计划里,会用分治做。。 1 #include <stdio.h> 2 #include <string.h> 3 #define N 50001 4 int o[N]; 5 int find(int x) 6 { 7 int r,t; 8 r = x; 9 while
·
2015-11-11 10:11
poj
POJ 2524 Ubiquitous
Religions
(并查集)
文章作者:ktyanny 文章来源:ktyanny 转载请注明,谢谢合作。 ktyanny:a的第二道并查集。第一题在 这里 题目描述: 世界上宗教何其多。假设你对自己学校的学生总共有多少种宗教信仰很感兴趣。学校有n个学生,但是你不能直接问学生的信仰,不然他会感到很不舒服的。有另外一个方法是问m对同学,是否信仰同一宗教。根据这些数据,相信聪明的
·
2015-11-08 12:27
poj
POJ 2524 Ubiquitous
Religions
【并查集】
解题思路:输入总人数 n,和m组数据;即和杭电畅通工程相类似,对这m组数据做合并操作后,求最后一共有多少块区域。 #include<stdio.h> int pre[50001]; int find(int root) { if(root!=pre[root]) pre[root]=find(pre[root]); return pre[root]; } v
·
2015-11-07 14:40
poj
Ubiquitous
Religions
(并查集)
Description There are so many different
religions
in the world today that it is difficult to keep track
·
2015-11-07 11:26
并查集
Ubiquitous
Religions
--POJ 2524
1、解题思路:并查集。 2、注意事项:借用father[]、rank[]两个数组记录的小技巧。 3、实现方法: 1 #include < iostream > 2 #define M 50010 3 using namespace std;
·
2015-11-02 16:58
poj
POJ 2524 (简单并查集) Ubiquitous
Religions
题意:有编号为1到n的学生,然后有m组调查,每组调查中有a和b,表示该两个学生有同样的宗教信仰,问最多有多少种不同的宗教信仰 简单并查集 1 //#define LOCAL 2 #include <iostream> 3 #include <cstdio> 4 #include <cstring> 5 using n
·
2015-11-02 11:52
poj
poj 2524 Ubinquitous
Religions
(并查集)
http://poj.org/problem?id=2524 依旧简单并查集,拿1611火速改了改火速提交,果断PE...把输出的最后一个空格放%d前面了,真活该不运行就交。 但是这题有个疑问,为什么按秩合并没有比直接合并快?? code: #include<cstdio> int p[ 50005], r[ 50005]
·
2015-11-01 16:35
poj
pku 2524 Ubiquitous
Religions
http://poj.org/problem?id=2524 题目分类是分治,我不知道怎么用分治。并查集1y.注意这里每个人最多有一个宗教信仰 View Code #include <iostream>#include <cmath>#include <cstdio>#include <cstring>#define maxn 5000
·
2015-11-01 14:56
pku
pku2524-----Ubiquitous
Religions
(初次接触并查集)
方法一:time limited:对于合并操作要搜遍全部元素 Code //并查集 //方法一:用集合中最小元素标记集合。 //对于合并操作要搜遍全部元素。 #include<stdio.h> int set[50001],n,m,a,b,caseno=0; void init() { &n
·
2015-11-01 09:41
并查集
POJ 2524 Ubiquitous
Religions
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 17089
·
2015-10-31 15:52
poj
POJ 2524 Ubiquitous
Religions
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-10-31 11:34
poj
POJ 2524 Ubiquitous
Religions
(最简单的并查集)
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-10-31 11:46
poj
poj2524
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 
·
2015-10-31 10:11
poj
POJ---2524 Ubiquitous
Religions
[简单并查集]
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 17762
·
2015-10-31 10:23
poj
Ubiquitous
Religions
(无处不在的宗教)
poj 2524 并查集基础题,但是由于刚开始不熟悉,还是错了好几次 题目大意:有学生学号1--n,给你一些学生之间的关系,即属于同一宗教的学生, 找出共有多少不同的宗教数 解决:就是一个并查集的最基础题目,写个并查集就过了 #include <stdio.h> #include <string.h> int num[50005]; int n,m;
·
2015-10-31 10:28
qui
POJ 2524 Ubiquitous
Religions
(并差集)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2524 #include <iostream>//对并差集的不熟悉 #include <cstdio> using namespace std; long p[50010],n,m,tmp,rel[50010];
·
2015-10-31 09:27
poj
PKU POJ 2524 解题报告(并查集)
并查集学习--并查集详解 Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-10-31 08:30
poj
查找 --- 并查集
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 22601
·
2015-10-30 11:18
并查集
POJ 2524 Ubiquitous
Religions
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-10-27 15:48
poj
poj2524-Ubiquitous
Religions
C - Ubiquitous
Religions
Time Limit: 5000 MS Memory Limit: 65536 KB 64-bit integer
·
2015-10-21 11:03
poj
POJ 2524 Ubiquitous
Religions
(并查集)
#include #defineMAX_STDDENTS50000 intnumOfStudents,numOfPairs; intreligion[MAX_STDDENTS+1]; intrank[MAX_STDDENTS+1]; voidmakeSet(){ intstudent; for(student=1;studentrank[another]){ religion[
tiutiu2011
·
2015-10-08 15:00
poj
并查集
Ubiquitous
2524
Religions
POJ 2524 Ubiquitous
Religions
(宗教种类:并差集)
链接:http://poj.org/problem?id=2524UbiquitousReligionsTimeLimit:5000MSMemoryLimit:65536KTotalSubmissions:27774Accepted:13610DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttok
hellohelloC
·
2015-08-30 10:00
Ubiquitous
Religions
(POJ_2524)
DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinterestedinfindingouthowmanydifferentreligionsstudentsinyouruniversitybelievein.Youknowthattherea
highmath_Final
·
2015-08-18 16:00
POJ 2524 Ubiquitous
Religions
POJ2524UbiquitousReligionsDescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinterestedinfindingouthowmanydifferentreligionsstudentsinyouruniversityb
qq_21120027
·
2015-08-14 20:00
poj
并查集
Poj 2524 Ubiquitous
Religions
请点击此处,将会让你传送 #include usingnamespacestd; constintmaxn=50000+5; intfa[maxn],rank[maxn]; intm,n,ans; voidInit(intx) { for(inti=0;irank[fy]) { fa[fy]=fx; //sum[fx]+=sum[fy]; } else { fa[fx]=fy; if(rank
qingshui23
·
2015-08-10 11:00
并查集
POJ - 2524 - Ubiquitous
Religions
(并查集)
UbiquitousReligionsTimeLimit:5000MS MemoryLimit:65536KTotalSubmissions:27235 Accepted:13376DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackoft
violet_echo_0908
·
2015-07-25 15:00
poj
并查集
POJ 2524 Ubiquitous
Religions
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536K Total Submissions
·
2015-07-18 19:00
poj
Ubiquitous
Religions
UbiquitousReligionsTimeLimit:5000MS MemoryLimit:65536KTotalSubmissions:26678 Accepted:13127DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinteres
huayunhualuo
·
2015-06-16 17:00
poj 并查集 - 2524 Ubiquitous
Religions
并查集题目,并的意思就是将两个不同类别的集合合并到一起,类似于两棵树合并;查的意思就是找到这个点所属集合的根节点。基本上并查集题目都是在大体架构上面加一些东西即可。并查集代码模板在这里点击打开链接每个人都可能有不同的信仰,有n个学生,给出一些line,每个line里的两个人信仰一样,最后判断有n个学生中最多有多少信仰。我们在原本模板上加入一个记录信仰数的变量num,一开始num=n,在合并两个有相
u010006643
·
2015-04-24 20:00
poj
并查集
poj Ubiquitous
Religions
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 25579 Accepted: 12637DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
Lionel_D
·
2015-01-31 18:00
POJ 2524 Ubiquitous
Religions
(并查集)
UbiquitousReligionsTimeLimit:5000MS MemoryLimit:65536KTotalSubmissions:25556 Accepted:12619DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinteres
u013068502
·
2015-01-29 10:00
poj
POJ2524 Ubiquitous
Religions
并查集
并查集水题。求出并查集中集合的个数。#include #include usingnamespacestd; #defineMAX50010 intpar[MAX],rank[MAX]; voidInit(intn) { for(inti=1;irank[y]) { par[y]=x; rank[x]+=rank[y]; } else { par[x]=y; rank
AC_Gibson
·
2015-01-04 20:00
POJ-2524-Ubiquitous
Religions
(基本并查集!)
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 25152 Accepted: 12406DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
u014355480
·
2014-11-21 12:00
Algorithm
C++
C语言
ACM
并查集
poj 2524-Ubiquitous
Religions
(并查集)
题目大意:在一个大学里面有的学生信仰不同的宗教,注意一点就是下面没出现的学生,视为他们各自信仰不同的宗教。问总共有多少个宗教?解析:并查集的水题。直接上模板。#include #include usingnamespacestd; constintN=50010; intn,m; intpa[N],son[N]; voidinit(){ for(inti=1;i<=n;i++){ pa[i]=i;
HelloWorld10086
·
2014-11-14 11:00
poj
2524
Religions
Ubiquitous
POJ - 2524Ubiquitous
Religions
同样是一道并查集直接用的题目,我们最初把宗教信仰看成每个人新一个,然后和一个减一个,就可以了。#include #include #include usingnamespacestd; inttree[50009],sum; intfind(intx) { if(tree[x]==x) { returnx; } return(tree[x]=find(tree[x])); } voidmake
Mosu_
·
2014-11-04 20:00
POJ2524——Ubiquitous
Religions
DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinterestedinfindingouthowmanydifferentreligionsstudentsinyouruniversitybelievein.Youknowthattherea
Guard_Mine
·
2014-09-27 22:00
并查集
poj 2524 Ubiquitous
Religions
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 24722 Accepted: 12202DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
u014028231
·
2014-09-20 21:00
poj 2524 Ubiquitous
Religions
DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinterestedinfindingouthowmanydifferentreligionsstudentsinyouruniversitybelievein. Youknowthatthere
Misdom_Tian_Ya
·
2014-09-20 11:00
POJ 2524 Ubiquitous
Religions
//简单并查集
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 24528 Accepted: 12087DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
Ash_Zheng
·
2014-08-19 15:00
并查集
POJ – 2524 Ubiquitous
Religions
Ubiquitous
Religions
Time Limit: 5000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u [Submit
·
2014-08-11 16:00
poj
Ubiquitous
Religions
Memory Limit: 65536KTotal Submissions: 24131 Accepted: 11894DescriptionThere are so many different
religions
zchlww
·
2014-08-01 21:00
算法
namespace
iostream
POJ 2524 Ubiquitous
Religions
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 24111 Accepted: 11881DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
u013263923
·
2014-07-31 16:00
E - Ubiquitous
Religions
(8.4.4)
E- UbiquitousReligions(8.4.4)TimeLimit:5000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackof
u014028231
·
2014-07-31 10:00
(超简单并查集)POJ2524 Ubiquitous
Religions
(8.4.4)
DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareinterestedinfindingouthowmanydifferentreligionsstudentsinyouruniversitybelievein.Youknowthattherea
u014665013
·
2014-07-28 18:00
[ACM] POJ 2524 Ubiquitous
Religions
(并查集)
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 23093 Accepted: 11379DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
sr19930829
·
2014-07-14 16:00
ACM
并查集
POJ2524——Ubiquitous
Religions
(并查集)
赤裸裸的并查集#include #include #include usingnamespacestd; intf[50010],vis[50010]; intfind(intx) { returnf[x]==x?x:find(f[x]); } intmain() { intm,n,i,j,k,t,ans,x,y,p; t=0; while(cin>>n>>m) { t++; p=ans=0; m
u014141559
·
2014-07-08 20:00
poj2524--Ubiquitous
Religions
UbiquitousReligionsTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 22657 Accepted: 11166DescriptionTherearesomanydifferentreligionsintheworldtodaythatitisdifficulttokeeptrackofthemall.Youareint
u013015642
·
2014-05-20 15:00
poj 2524 Ubiquitous
Religions
(并查集)
题目:poj2524UbiquitousReligions(并查集)题目大意:n个大学生进行m次调查,给出信仰相同的大学生之间的关系,问这n个大学生里有多少种不同的信仰。解题思路:并查集。代码:#include constintN=50005; intf[N]; voidinit(intn){ for(inti=0;i<=n;i++) f[i]=i; } intgetfather(intx
u012997373
·
2014-04-23 09:00
上一页
1
2
3
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他