题目大意一颗树,除根节点外初始都是白点,根节点是黑点。 
每次染黑一个结点或者询问一个结点的最近黑色祖先。倒序处理倒着做,于是每次是染白一个结点。 
那么就并查集搞呀!#include
#include
#define fo(i,a,b) for(i=a;i=b;i--)
using na...
                            
                            
                                分类:
其他好文   时间:
2016-05-12 15:10:18   
                                阅读次数:
159
                             
                    
                        
                            
                            
                                1/ OpenMP 只是编译器的拓展,用#pragma directive(编译制导指令)来标注。如果不能并行,编译器只会忽略,并行地执行代码而不会报错。这样的作用是,可以比较方便地平行某段代码而不用大改。
 
2/ MIMD 和 SIMD最大的区别是,MIMD意思就是用到multi-core而SIMD则是同一个core。
 
3/使用OpenMP需要在GCC的compiler上加上-fo...
                            
                            
                                分类:
其他好文   时间:
2016-05-12 06:55:32   
                                阅读次数:
273
                             
                    
                        
                            
                            
                                Add Digits
Total Accepted: 92455 Total
 Submissions: 190510 Difficulty: Easy
Given a non-negative integer num, repeatedly
 add all its digits until the result has only one digit.
Fo...
                            
                            
                                分类:
其他好文   时间:
2016-05-07 11:24:50   
                                阅读次数:
137
                             
                    
                        
                            
                            
                                #include
#include
#include
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define efo(i,u) for(int i=last[u];i;i=next[i])
using namespace std;
typedef long long ll;
const int N=100...
                            
                            
                                分类:
其他好文   时间:
2016-05-07 08:54:51   
                                阅读次数:
162
                             
                    
                        
                            
                            
                                DescriptionIn the second year of the university somebody started a study on the romantic relations between the students. The relation “romantically involved” is defined between one girl and one boy. Fo...
                            
                            
                                分类:
其他好文   时间:
2016-05-06 12:41:38   
                                阅读次数:
180
                             
                    
                        
                            
                            
                                首先用man查看下popen的介绍: popen(3) - Linux man page Name popen, pclose - pipe stream to or from a process Synopsis popen总是和pclose一起出现被使用的。popen() 创建一个管道,通过fo ...
                            
                            
                                分类:
其他好文   时间:
2016-05-06 09:21:43   
                                阅读次数:
169
                             
                    
                        
                            
                            
                                After installed the AX 2012, we would found that there are five database was created in the SQL server. 1、MicroSoftDynamicsAxapta:The main database fo ...
                            
                            
                                分类:
数据库   时间:
2016-05-05 16:04:01   
                                阅读次数:
249
                             
                    
                        
                            
                            
                                    Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo ...
                            
                            
                                分类:
其他好文   时间:
2016-05-04 20:48:40   
                                阅读次数:
118
                             
                    
                        
                            
                            
                                    练习一: //用户输入姓名,然后打印此人的年龄,从1岁-18岁,每一岁占一行,打印内容为“我今年xxx岁了!”; //当6岁时增加打印“我上小学了!”; //当11岁时增加打印“我上初中了!”; //当15岁时增加打印“我上高中了!”; //当18岁时增加打印“我成年了!考上了北大!”; 1、用fo ...
                            
                            
                                分类:
其他好文   时间:
2016-05-04 01:11:15   
                                阅读次数:
220
                             
                    
                        
                            
                            
                                Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo ...
                            
                            
                                分类:
编程语言   时间:
2016-05-02 22:49:28   
                                阅读次数:
190