Codeshark #4

Revision en5, by M_H_M, 2016-05-23 18:03:38

Codeshark is an Iranian judge. ( like ProjectEuler )
Me ( M_H_M ), Iman ( IMAN_GH ) & Hamid ( ITDOI ) prepared the round #4 :

It is my problem :

In MooSooLestan, there are lots of strange trees with unlimited vertices.
strangest one is MooSooLi's tree :
---- The degree of each vertex(the number of adjacent's vertices) is equal to the id of that vertex.
---- The tree is rooted from vertex with id 1.
---- If x < y, the whole id of x's children fewer than y's children. ---- The id of vertices are natural numbers.

There is another tree named MoosMasak which is really same as MooSooLi's tree with one difference.
The difference is the number of each vertex's children with x is equal to biggest power of 2 that x is divisible by that.

Left : MooSooLi ---- Right : MoosMasak

Subtasks :

1) What is the sum of ancestors of 10 ^ 12 in MooSooLi?
2) What is the sum of ancestors of 10 ^ 12 in MoosMasak?
3) What is the sum of subtree of 17 in heights [0, 9) in MooSooLi?
4) What is the sum of subtree of 17 in heights [0, 18) in MoosMasak?
All of them mod 10 ^ 9 + 7

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English M_H_M 2016-05-23 18:03:38 5 Tiny change: '[codeshark.ir](http://c' -> '[Codeshark](http://c'
en4 English M_H_M 2016-05-22 14:54:05 28 Tiny change: 'ak? <br>\n' -> 'ak? <br>\nAll of them mod 10 ^ 9 + 7\n'
en3 English M_H_M 2016-05-22 07:32:34 0 (published)
en2 English M_H_M 2016-05-21 21:02:45 978 Tiny change: '1/1-1.jpg)' -
en1 English M_H_M 2016-05-21 16:32:27 320 Initial revision (saved to drafts)