HDU 3723 Delta Wave (number of golden years)

Source: Internet
Author: User

Transmission Door

Delta Wave Time limit:6000/3000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 1160 Accepted Submission (s): 370


Problem Description A Delta wave is a high amplitude brain wave in humans with A frequency of 1–4 hertz which can be rec Orded with a electroencephalogram (EEG) and is usually associated with slow-wave sleep (SWS).
–from Wikipedia

The researchers has discovered a new kind of species called "otaku", whose brain waves is rather strange. The Delta wave of an otaku ' s brain can is approximated by a polygonal line in the 2D coordinate system. The line was a route from point (0, 0) to (N, 0), and it was allowed to move only to the right (up, down or straight) at Eve Ry step. And during the whole moving, it is not allowed to dip below the y = 0 axis.

For example, there is the 9 kinds of the delta waves for N = 4:





Given N, you is requested to the find out how many kinds of different delta waves of otaku.
Input there is no more than test cases. There is only one line for each case, containing an integer n (2 < N <= 10000)


Output output one line for each test case. For the answer is quite huge, you need only output the answer module 10100.
Sample Input

4

Sample Output

9

Source of Asia Tianjin regional Contest

Main topic:
On an infinitely large "grid", limit "each step can only move to the right of one block (can right up, right and left), and prohibit moving to the place below y=0", let you ask in this way with n steps from (0,0) to (n,0) the total number of possible paths formed.
Problem Solving Ideas:
Actually, the problem is, let's ask n The amount of the implied gold, the amount of the implied gold is in mathematics, a given number of N of the amount of the amount of the sum of the "N points in a circle, the total number of ways to draw a chord that does not intersect with each other", can also be understood as the above test instructions in the way. Its formula is M n =(2?N+1)? M n? 1 +3?(N?1)? M n? 2 N+2
Can also be written as:
M n =∑ ? n/2 ? i=0 C (N,2I)C aTaLaN(I)

This topic has a large range of data, so use Java To do, and then is to take the rest of the time need to pay attention to not in the middle to take the remainder, because there is division, need to ask the inverse (as if there is an exception, not very clear), so in order to save things directly in the left after the mold on the line.

Import Java. IO.*;Import Java. Math. BigDecimal;Import Java. Math. BigInteger;Import Java. Util. Calendar;Import Java. Util. HashSet;Import Java. Util. Scanner;Import Java. Util. Set;public class main{public static void Main (String args[]) {BigInteger a[] = new biginteger[100005];Final BigInteger MOD = BigInteger. ValueOf(Ten). Pow( -);a[1] = BigInteger. One;a[2] = BigInteger. ValueOf(2);for (int i=3; i<10005; i++) {A[i] = (a[i-1]. Multiply(BigInteger. ValueOf(2*i+1)). Add(a[i-2]. Multiply(BigInteger. ValueOf(3*i-3))) ). Divide(BigInteger. ValueOf(i+2));} Scannerinch= New Scanner (System. in);int n;Whileinch. Hasnextint()) {n =inch. Nextint();System. out. println(A[n]. MoD(MOD));}    }}

HDU 3723 Delta Wave (number of default)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.