两个int count有问题,是否还有一个全局的在顶上?外面只要一个int count,LeafNode里面这样修改:if符合条件时return 1; if后面改为return LeafNode(t->lchild)+LeafNode(t->rchild);