链接:http://uva.onlinejudge.org/index.php option=com_onlinejudge&Itemid=8&category=8&page=show_problem&problem=640
题意是模拟一颗“落叶树”,母结点和子节点的水平距离是1。求从左到到右每列的落叶总数。
挺水的一道题,当时就直接想到哪写到哪了。
直接建立一颗二叉树,用数组来统一每列的落叶数,根结点对应于数组中央。
代码:
#include
#include
#include
#include
#include