| |

VerySource

 Forgot password?
 Register
Search
View: 841|Reply: 3

It should be a DP issue.

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-1 15:40:01
| Show all posts |Read mode
Given a sequence A consisting of n 1s and n -1s, if the sequence A satisfies S (i, A)> = 0 (1 <= i <= 2n) (S (i, X) represents the previous sequence X i term sum), then call it sequence B, given the integer n, find the number of sequences B that satisfy the condition.
Given an integer n (2 <= n <= 3000), find the number of sequences B that meet the above requirements
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-3-21 19:00:02
| Show all posts
Is it possible to do this: first create an array (length 2n), the array is used to store the sum of the first k + 1 items of the array index k, and then start a loop to count, the sum of the array> = 0 then ++ . Last print number
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-19 20:45:01
| Show all posts
The sequence b consisting of n 1s and n-1s, and the m digits in front of the sequence are 1, the m-1th is -1, the number of such sequences is set as
a [n] [m],

Then a [n] [m] = a [n-1] [m-1] + a [n-1] [m] + ... a [n-1] [n-1]

And a [n] [1] + a [n] [2] + ... + a [n] [n] is the result of lz
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-25 17:15:02
| Show all posts
Looks like there is a mathematical solution, without DP
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list