Responsive image

问题 1868 --Mystery

1868: Mystery

时间限制: 3 Sec  内存限制: 128 MB
提交: 2  解决: 2
[提交][状态][讨论版][命题人:]

题目描述

Hazel would like to find out everything about the binary tree.
She has a **full** binary tree ,each point has different labels.
regarding each point of tree ,Hazel defines its height hi being the number of points which the shortest path from this point to a leaf has.
each point has weight Ai which be defined as Xhi.
Hazel wants to paint every points by color Bi,Observing the following rules:
∙ ∀i∈T,Bi∈N
∙ ∀i∈T,Bi≥Bfai
∙ Y≥2×∑i∈leafBi−∑i∈TBi
(define Bfaroot=0 )
Hazel defines the contribution of the tree S as ∑i∈TAi×Bi.
She wants to know how many legal methods can she paint the tree,which cause S is multiple of P.
You need to print ans mod(10^9+7).
 

输入描述

4 positive integerH,X,Y,P(1≤H≤1018,1≤X≤500,0≤Y≤10,1≤P≤500,P is a prime number).
Hmeans the tree has2^H−1 points.
 

输出描述

an integer showing ans mod(10^9+7).

样例输入

2
8 10 7 11
34819237827249996 146 5 349

样例输出

630072624
673102984

来源

 

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版