摘要: 地址:http://poj.org/problem?id=3321 http://acm.hit.edu.cn/hoj/problem/view?id=2743这两道题其实一个意思,题意是一棵苹果树,分叉,用poj的题意来讲,每个叉有个编号,根节点永远是1,然后按它输入的每两个数相连,构成一棵树,初始每个节点一个苹果,输入C和一个数字,如果此节点有苹果,让它变为0,如果没有苹果,让它变为1,输入Q,查询这个节点的子树上有多少个苹果。这道题是今天做的第一道DFS序,其实本质还是线段树,单点变换,区间求和,模板都固定,就是看怎么构树,用vector存数据,如1节点连着2,3,那么v[1]里存入2. 阅读全文
posted @ 2013-08-02 17:00 SunnySnail 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Card HandsMy Tags(Edit)Source:unknownTime limit: 2 secMemory limit: 64 MSubmitted: 204,Accepted: 49Jim is writing a program for statistically analyzing card games. He needs to store many different card hands in memory efficiently. Each card has one of foursuitsand one of thirteenvalues. In his imple 阅读全文
posted @ 2013-08-02 08:50 SunnySnail 阅读(498) 评论(0) 推荐(0) 编辑