| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11605 | Polynomial Calculator |
|
| 11622 | pF - Full House |
|
Description
You are given a polynomial f(x). deg(f(x)) = N.
Given a integer M, please output the answer of f(M).
Sample Output Explanation : in sample input, the equation is x3 - x + 3, When M = 2, f(M) = 9
Input
The first line contains two integer numbers N, M, representing the degree of f(x) and the input number.
The second line contains N+1 integer numbers an, ... , a1, a0, representing the coefficient of xn, xn-1, ... , x2, x1, x0.
- 1 ≤ N ≤ 100
- -1000 ≤ M, ai ≤ 1000
- -109 ≤ f(M) ≤ 109
Output
Please output the answer of f(M)
Remember to print '\n' after your answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The "Mannulus" casino is now celebrating its grand opening in Canterlot! The owner, Lightyear, introduces the cutting-edge technology to the casino : Farseer Cards Auto Detect System. If it works well, the casino will no longer need to employ any dealer!
The question is : the system cannot automatically rank the cards in the correct order. So Lightyear decides to hire a group of programmers to improve the whole system. You, as a beginning programmer, is assigned to write a program to check whether a set of five cards forms a full house or not. Lightyear will then give you T sets of cards to verify the correctness of your program.
Do not disappoint him.
** For someone who doesn't know the definition of full house : https://en.wikipedia.org/wiki/List_of_poker_hands#Full_house
Input
The first line contains an integer T, representing the number of sets Lightyear gives to you.
The next T lines contain 5 cards in each given set, separated by whitespaces.
The cards would range from : {A, 2, 3, 4, 5, 6, 7, 8 ,9 ,10, J, Q, K}.
(In this problem, you don't need to consider the suit of each card.)
-
1 ≤ | T | ≤ 10000
Output
For each set of card, please print 'YES' if the set is a full house, otherwise please print 'NO'.
Remember to print '\n' after each answer.