Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
北京大学《ACM-ICPC竞赛训练》暑期课面向全球招生。容量有限,报名从速!
Language:
Invariant Polynomials
Time Limit: 2000MSMemory Limit: 65536K
Total Submissions: 315Accepted: 124

Description

Consider a real polynomial P (x, y) in two variables. It is called invariant with respect to the rotation
by an angle α if
P (x cos α - y sin α, x sin α + y cos α) = P (x, y)

for all real x and y.
Let's consider the real vector space formed by all polynomials in two variables of degree not greater than d invariant with respect to the rotation by 2π/n. Your task is to calculate the dimension of this vector space.
You might find useful the following remark: Any polynomial of degree not greater than d can be uniquely written in form
P (x, y) = Σi,j>=0,i+j<=daijxiyj

for some real coefficients aij .

Input

The input contains two positive integers d and n separated by one space. It is guaranteed that they are less than one thousand.

Output

Output a single integer M which is the dimension of the vector space described.

Sample Input

2 2

Sample Output

4

Source

Northeastern Europe 2003, Northern Subregion

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator