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






goodniao_1

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 9 10 11 12 13 14 15 下一页

2014年3月4日

hdu 1272 并查集
摘要: 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1272小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 22383Accepted Submission(s): 6841Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果 阅读全文
posted @ 2014-03-04 16:01 goodniao_1 阅读(187) 评论(0) 推荐(0)
 
hdu 3635 并查集
摘要: 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=3635Dragon BallsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2273Accepted Submission(s): 888Problem DescriptionFive hundred years later, the number of dragon balls will increase unexpectedly, so it& 阅读全文
posted @ 2014-03-04 11:44 goodniao_1 阅读(138) 评论(0) 推荐(0)
 

2014年3月3日

poj 1182 并查集
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define N 50005 8 using namespace std; 9 // rank[x] 表示 parent[x]与x 的关系, rank[x]=0 同类, rank[x]=1 根吃x, rank[x]=2 , x吃根10 int rank[N]; 11 int parent[N];12 int n;13 void init()14 {15 for(int i=1;in || v>n ||(D==2 && u==v)) {4 阅读全文
posted @ 2014-03-03 21:58 goodniao_1 阅读(191) 评论(0) 推荐(0)
 
hdu 1856 并查集 求最大的子树含有元素的个数
摘要: 这道题数据有点大, 我再次 被 cin>> he cin#include#include#include#include#include#define N 10000005#define M 100005using namespace std;int rank[N];int parent[N];int sumnum[N];int Find(int x){ if(x== parent[x]) return x; return parent[x]=Find(parent[x]);}void Union(int x, int y){ int xf=Find(x); int... 阅读全文
posted @ 2014-03-03 16:43 goodniao_1 阅读(179) 评论(0) 推荐(1)
 
hdu 1232 / 1213 并查集(求子集个数)
摘要: 并查集 模板:用到了两个优化 ,一个是按秩(rank)合并,一个是路径压缩。 1 int rank[N]; 2 int parent[N]; 3 int n; 4 void init() 5 { 6 int i; 7 for( i=1;i rank[yf])23 parent[yf]=xf;24 else25 {26 parent[xf] =yf;27 if(rank[xf] == rank[yf])28 rank[yf]++;29 }30 }1:初始化init(), 创建n-1 颗... 阅读全文
posted @ 2014-03-03 11:04 goodniao_1 阅读(392) 评论(0) 推荐(1)
 

2014年3月2日

hdu 4501 动态规划 + 费用背包问题
摘要: 题目 来源:http://acm.hdu.edu.cn/showproblem.php?pid=4501小明系列故事——买年货Time Limit: 5000/2000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2126Accepted Submission(s): 946Problem Description 春节将至,小明要去超市购置年货,于是小明去了自己经常去的都尚超市。 刚到超市,小明就发现超市门口聚集一堆人。用白云女士的话说就是:“那家伙,那场面,真是人山人海,锣鼓喧.. 阅读全文
posted @ 2014-03-02 18:37 goodniao_1 阅读(308) 评论(0) 推荐(1)
 
hdu 4503 找全是朋友或全不是朋友
摘要: 湫湫系列故事——植树节Time Limit: 1000/500 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 935Accepted Submission(s): 556Problem Description 今天是一年一度的植树节,腾讯幼儿园要求每个老师在班里选出几个小朋友一起去野外种植小树苗,根据学校的整体安排,湫湫老师的班里要选出3个小朋友。已知湫湫的班里共有n个孩子,每个孩子有Bi个朋友(i从1到n),且朋友关系是相互的,如果a小朋友和b小朋友是朋友,那么b小朋友和a小朋友也. 阅读全文
posted @ 2014-03-02 17:53 goodniao_1 阅读(283) 评论(0) 推荐(0)
 
hdu 数论专题
摘要: hdu 13592^x mod n = 1Problem DescriptionGive a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.InputOne positive integer on each line, the value of n.OutputIf the minimum x exists, print a line with 2^x mod n = 1.Print 2^? mod n = 1 otherwise.You should replace x and n with specifi 阅读全文
posted @ 2014-03-02 14:15 goodniao_1 阅读(160) 评论(0) 推荐(0)
 

2014年3月1日

codeforce Round On Sum of Fractions + stl 的应用
摘要: D. On Sum of FractionsLet's assume thatv(n)is the largest prime number, that does not exceedn;u(n)is the smallest prime number strictly greater thann.Find.InputThe first line contains integert(1 ≤ t ≤ 500)— the number of testscases.Each of the followingtlines of the input contains integern(2 ≤ n 阅读全文
posted @ 2014-03-01 22:29 goodniao_1 阅读(146) 评论(0) 推荐(0)
 
codeforce Round #232 Div2 map + 质因子 +组合
摘要: C. On Number of Decompositions into MultipliersYou are given an integermas a product of integersa1, a2, ...an. Your task is to find the number of distinct decompositions of numberminto the product ofnordered positive integers.Decomposition intonproducts, given in the input, must also be considered i 阅读全文
posted @ 2014-03-01 17:22 goodniao_1 阅读(193) 评论(0) 推荐(1)
 
上一页 1 ··· 9 10 11 12 13 14 15 下一页