1034 - I2P EECS 2016 HW4 Scoreboard

Time

2016/10/06 22:00:00 2016/10/12 09:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11128 Binomial coefficient
10075 I2P homework3b

11128 - Binomial coefficient   

Description

The kth binomial coefficient indexed by n can be calculated by the following relation :
C(n, 0) = 1, for n = 1, 2, …
C(n, 1) = n, for n = 1, 2, …
C(n, n) = 1, for n = 1, 2, …
C(n, k) = C(n-1, k-1) + C(n-1, k),  for k = 2, 3, … and for n = 2, 3, …

Given a nonnegative integer M, display the binomial coefficients indexed by M.
Use '%10d' to print each element. There is no need to print a newline at the end.

Input

A positive integer M (1<=M<=30).

Output

 Print the binomial coefficients indexed by M.

Sample Input  Download

Sample Output  Download

Tags




Discuss




10075 - I2P homework3b   

Description

The input contains nine different numbers, which are 1 to 9 in some random order, for example, 4 1 5 9 8 7 3 6 2. Now, start from the first place, we get the number 4. It indicates that the next number we need to pick is at the 4th place, which is 9. Likewise, we then go the 9th place and get the number 2. We repeat this process until we go to a place that has already been visited. In this example, we will stop at the second place and get the number 1, because we have found a circle. Therefore, along the way we pick four numbers, 4 9 2 1, and the output is the sum of these numbers, which is 16.
Note that we always start from the first place.
Other examples: Consider the input 2 3 4 5 6 7 8 9 1, the output should be 45 since we will visit the numbers one by one and go back to the beginning. Consider the input 1 9 8 7 6 5 4 3 2, the output should be 1 since we stop immediately and cannot go anywhere. Consider the input 9 2 3 4 5 6 7 8 1, the output should be 10.
 

Input

A random sequence of the nine different numbers of 1 to 9.

Output

The sum of the numbers being visited. Remember to print a '\n' at the end of the sum.

Sample Input  Download

Sample Output  Download

Tags




Discuss