[Algorithm] Using binary polynomial coefficients and links

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤ micro-channel public number: Shan Wing Chi ( shanqingyongzhi)
➤ blog Park address: San-ching Wing Chi ( https://www.cnblogs.com/strengthen/ )
➤GitHub address: https://github.com/strengthen/LeetCode
➤ original address: HTTPS: // the WWW. cnblogs.com/strengthen/p/10994773.html
➤ If the link is not the blog Chi Wing Shan Park address, it may be crawling author of the article.
➤ text has been modified update! Click strongly recommended that the original address read! Support authors! Support the original!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

Monomial (monomial): algebraic expression of numbers or letters that is the product called monomials, a single letter or number, also called monomials. This term is a translation of the Qing Dynasty mathematician Li Shan-Ian finished the book in accordance with the original concept of the word. Digital single factor in the formula is called the monomial coefficients (Coefficient), a single formula, and all the letters of the index number is called the monomial (Degree of a monomial). Individual style is several times, several times called individual style.

Polynomial (Polynomial) Definition: it refers to a variable, and adding coefficient between them, subtraction, multiplication, exponentiation (non-negative integer power) obtained expression.

Generalized polynomials: 1 or 0 and are also considered monomial polynomial. By broad definition, a polynomial is Zhengshi. In fact, there is not a polynomial function of only narrow, Theorem monomials ineffective. 0 as a polynomial, is defined as the number of negative infinity (or 0). Monomial and polynomial collectively referred to as Zhengshi. Polynomial term, no letter is called a constant term. Continuous function is a simple polynomial, which is smooth, it must also be differential polynomial.

Polynomial function: the form f (x) = an · x ^ n + an-1 · x ^ (n-1) + ... + a2 · x ^ function 2 + a1 · x + a0, called polynomial function, which is a constant argument x after a limited number of multiplication and addition operations obtained. When n = 1, which is a linear function y = kx + b, when n = 2, which is a quadratic function.

 

Question: is known a polynomial function f (x) on the x, f (x) coefficients are positive integers, enter a positive integer N, the black box return value f (N) in a black box, will enter at least the number of times the coefficient of each item can be obtained polynomial f (x), that is obtained polynomial function f (x)?

 

Thought process:

The band is essentially based on the binary variable polynomial coefficients.

Example: Decimal

4321=4*10^3+3*10^2+2*10^1+1*10^0

Answer: The black box only needs to be entered twice, you can get polynomial coefficients.

First: input 1, to ensure that the factor for any

Black box returns f (1): that the whole polynomial and coefficients. Referred to as S = f (1).

Second: the input is greater than the value of S S + N, where N is a positive integer. The black box output value F (S + N) S + N into binary, that is, the polynomial coefficients (S + N) binary digital representation.

Such as: Input S + 1, the black box output value F (S + 1) S + 1 into binary. which is:

f(S+1)= 

Is the coefficient corresponding to f (x) coefficients:

test:

Black box polynomial function: f (x) = 2 * x ^ 2 + 3 * x ^ 1 + 4 * x ^ 0

f(1)=9

f(9+1)=234

Intuitive to convert to decimal 234 234: 234 = 10 ^ 2 * 2 + 3 + 4 * 10 * 10 ^ 1 ^ 0

So coefficients of the polynomial function of the original order of 2,3,4.

Continue to test the polynomial function.

f(1)=9

f(9+2)=279

Short division 11 converts the hexadecimal 234 to 279: 279 = 11 ^ 2 * 2 + 3 + 4 * 11 * 11 ^ 1 ^ 0

So coefficients of the polynomial function of the original order of 2,3,4.

 

Guess you like

Origin www.cnblogs.com/strengthen/p/10994773.html