P2915 [USACO08NOV]红牛混合起来Mixed Up Cows

P2915 [USACO08NOV]水牛混合起来Mixed Up Cows,p2915usaco08nov

P2915 [USACO08NOV]红牛混合起来Mixed Up Cows

难题陈诉

Each of Farmer John’s N (4 <= N <= 16) cows has a unique serial
number S_i (1 <= S_i <= 25,000). The cows are so proud of it
that each one now wears her number in a gangsta manner engraved in large
letters on a gold plate hung around her ample bovine neck.

Gangsta cows are rebellious and line up to be milked in an order called
‘Mixed Up’. A cow order is ‘Mixed Up’ if the sequence of serial numbers
formed by their milking line is such that the serial numbers of every
pair of consecutive cows in line differs by more than K (1 <= K <=
3400). For example, if N = 6 and K = 1 then 1, 3, 5, 2, 6, 4 is a ‘Mixed
Up’ lineup but 1, 3, 6, 5, 2, 4 is not (since the consecutive numbers 5
and 6 differ by 1).

How many different ways can N cows be Mixed Up?

For your first 10 submissions, you will be provided with the results of
running your program on a part of the actual test data.

POINTS: 200

John家有N头水牛,第i头白牛的号子是Si,每头白牛的号子都以无可比拟的。这么些水牛近日在闹性子,为表明不满的心境,她们在挤奶的时候自然要排成混乱的武力。在一头混乱的队容中,相邻水牛的号子之差均超越K。举例当K = 1时,1, 3, 5, 2, 6,
4正是一支混乱的军旅, 而1, 3, 6, 5, 2,
4不是,因为6和5只差1。请数一数,有微微种队形是乱套的吧?

标题陈说

Each of Farmer John’s N (4 <= N <= 16) cows has a unique serial
number S_i (1 <= S_i <= 25,000). The cows are so proud of it
that each one now wears her number in a gangsta manner engraved in large
letters on a gold plate hung around her ample bovine neck.

Gangsta cows are rebellious and line up to be milked in an order called
‘Mixed Up’. A cow order is ‘Mixed Up’ if the sequence of serial numbers
formed by their milking line is such that the serial numbers of every
pair of consecutive cows in line differs by more than K (1 <= K <=
3400). For example, if N = 6 and K = 1 then 1, 3, 5, 2, 6, 4 is a ‘Mixed
Up’ lineup but 1, 3, 6, 5, 2, 4 is not (since the consecutive numbers 5
and 6 differ by 1).

How many different ways can N cows be Mixed Up?

金沙js333娱乐场,For your first 10 submissions, you will be provided with the results of
running your program on a part of the actual test data.

POINTS: 200

John家有N头白牛,第i头白牛的号子是Si,每头红牛的数码都以独步一时的。那几个水牛方今在闹个性,为发挥不满的心思,她们在挤奶的时候料定要排成混乱的人马。在二头混乱的队伍中,相邻水牛的号子之差均超越K。举例当K = 1时,1, 3, 5, 2, 6,
4就是一支混乱的军旅, 而1, 3, 6, 5, 2,
4不是,因为6和5只差1。请数一数,有微微种队形是无规律的吧?

难题汇报

Each of Farmer John’s N (4 <= N <= 16) cows has a unique serial
number S_i (1 <= S_i <= 25,000). The cows are so proud of it
that each one now wears her number in a gangsta manner engraved in large
letters on a gold plate hung around her ample bovine neck.

Gangsta cows are rebellious and line up to be milked in an order called
‘Mixed Up’. A cow order is ‘Mixed Up’ if the sequence of serial numbers
formed by their milking line is such that the serial numbers of every
pair of consecutive cows in line differs by more than K (1 <= K <=
3400). For example, if N = 6 and K = 1 then 1, 3, 5, 2, 6, 4 is a ‘Mixed
Up’ lineup but 1, 3, 6, 5, 2, 4 is not (since the consecutive numbers 5
and 6 differ by 1).

How many different ways can N cows be Mixed Up?

For your first 10 submissions, you will be provided with the results of
running your program on a part of the actual test data.

POINTS: 200

John家有N头白牛,第i头红牛的数码是Si,每头白牛的编号都以独步天下的。那些白牛方今在闹个性,为发挥不满的激情,她们在挤奶的时候应当要排成混乱的部队。在四头混乱的队伍中,相邻白牛的数码之差均超越K。举例当K = 1时,1, 3, 5, 2, 6,
4正是一支混乱的行伍, 而1, 3, 6, 5, 2,
4不是,因为6和5只差1。请数一数,有些许种队形是乱套的啊?

输入输出格式

输入格式:

  • Line 1: Two space-separated integers: N and K

  • Lines 2..N+1: Line i+1 contains a single integer that is the serial
    number of cow i: S_i

出口格式:

  • Line 1: A single integer that is the number of ways that N cows can
    be ‘Mixed Up’. The answer is guaranteed to fit in a 64 bit integer.

发表评论

电子邮件地址不会被公开。 必填项已用*标注