ACdream 1162
思路: 发现通过指针指向左右孩子,节点开销=区间长度*2-1;
int main()
{
int T;
LL x,y;
scanf("%d",&T);
for(int k=1;k<=T;k++)
{
scanf("%lld%lld",&x,&y);
printf("%lld\n",(y-x+1)*2-1);
}
return 0;
}
ACdream 1162
思路: 发现通过指针指向左右孩子,节点开销=区间长度*2-1;
int main()
{
int T;
LL x,y;
scanf("%d",&T);
for(int k=1;k<=T;k++)
{
scanf("%lld%lld",&x,&y);
printf("%lld\n",(y-x+1)*2-1);
}
return 0;
}