shunfurh
编程介的小学生
2018-12-28 09:36
采纳率: 92.7%
浏览 222

一个有关子树的数据结构方面的问题比较困惑,请问怎么C语言实现?

Problem Description
There is a complete binary tree with N nodes.The subtree of the node i has Ai nodes.How many distinct numbers are there of Ai?

Input
There are multiple test cases, no more than 1000 cases.
For each case contains a single integer N on a line.(1≤N≤1018)

Output
The output of each case will be a single integer on a line:the number of subtrees that contain different nodes.

Sample Input
5
6
7
8

Sample Output
3
4
3
5

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐