| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Apple Tree
Description There
is an apple tree outside of kaka's house. Every autumn, a lot of apples
will grow in the tree. Kaka likes apple very much, so he has been
carefully nurturing the big apple tree. The tree has N forks which are connected by branches. Kaka numbers the forks by 1 to N
and the root is always numbered by 1. Apples will grow on the forks and
two apple won't grow on the same fork. kaka wants to know how many
apples are there in a sub-tree, for his study of the produce ability of
the apple tree. The trouble is that a new apple may grow on an
empty fork some time and kaka may pick an apple from the tree for his
dessert. Can you help kaka? ![]() Input The first line contains an integer N (N ¡Ü 100,000) , which is the number of the forks in the tree. Output Sample Input Sample Output Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2007 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator