简单题,读懂题意就好,由于dp和ep都是叶子节点,这棵树又是满二叉树,所以,可以直接往上找到最近公共祖先,然后加减运算一下就好了View Code #include<cstdio>#include<cstdlib>int max(int a,int b){ return a>b?a:b;}int main(){ int d,e,f,dp,ep,h; while(scanf("%d%d%d%d%d%d",&d,&e,&f,&dp,&ep,&h)!=EOF) { int dep=0; dp--;ep- Read More
posted @ 2011-12-23 13:53 Because Of You Views(331) Comments(0) Diggs(0) Edit