当前位置:网站首页>2.16([Usaco2005 Nov]Ant Counting)
2.16([Usaco2005 Nov]Ant Counting)
2022-06-25 19:55:00 【lijuntao. boke】
describe
Bessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized that many of the ants were siblings, indistinguishable from one another. She also realized the sometimes only one ant would go for food, sometimes a few, and sometimes all of them. This made for a large number of different sets of ants!
Being a bit mathematical, Bessie started wondering. Bessie noted that the hive has T (1 <= T <= 1,000) families of ants which she labeled 1..T (A ants altogether). Each family had some number Ni (1 <= Ni <= 100) of ants.
How many groups of sizes S, S+1, ..., B (1 <= S <= B <= A) can be formed?
While observing one group, the set of three ant families was seen as {1, 1, 2, 2, 3}, though rarely in that order. The possible sets of marching ants were:
3 sets with 1 ant: {1} {2} {3}
5 sets with 2 ants: {1,1} {1,2} {1,3} {2,2} {2,3}
5 sets with 3 ants: {1,1,2} {1,1,3} {1,2,2} {1,2,3} {2,2,3}
3 sets with 4 ants: {1,2,2,3} {1,1,2,2} {1,1,2,3}
1 set with 5 ants: {1,1,2,2,3}
Your job is to count the number of possible sets of ants given the data above.
Input
* Line 1: 4 space-separated integers: T, A, S, and B
* Lines 2..A+1: Each line contains a single integer that is an ant type present in the hive
Output
* Line 1: The number of sets of size S..B (inclusive) that can be created. A set like {1,2} is the same as the set {2,1} and should not be double-counted. Print only the LAST SIX DIGITS of this number, with no leading zeroes or spaces.
The sample input
3 5 2 3 1 2 2 1 3
Sample output
10
translate :
describe
One day , Bessie wandered around the ant hill , Watching the ants walk around while looking for food . She realized that many ants are brothers and sisters , There is no difference between them . She also realized that , Sometimes only one ant will go looking for food , Sometimes a few , Sometimes all the ants . This produces a large number of different kinds of ants !
Bessie is a bit mathematical , Start thinking . Bessie noticed that there were T (1 <= T <= 1000) A family of ants , She classified the ants as 1.T( It's all ants ). Each family has a number of Ni (1 <= Ni <= 100) The ants of .
How many group sizes are S S+1…, B (1 <= S <= B <= A) Can form ?
When observing a group , The collection of three ant families is regarded as {1,1,2,2,3}, Although rarely in this order . The possible assembly of marching ants is :
3 Group 1 An ant :{1}{2}{3}
5 Ants gather :{1,1}{1,2}{1,3}{2,2}{2,3}
5 Set 3 Ant :{1 1 2}{1 1 3}{1,2,2}{1,2,3}{2 2 3}
{1,1,2,2} {1,1,2,2} {1,1,2,3}
1 Group 5 Only ants :{1,1,2,2,3}
Your job is to calculate the number of possible ant colonies based on the above data .
Input
The first 1 That's ok :4 An integer separated by a space :T, A, S, B
The first 2 That's ok A+1: Each line contains a single integer , It is the type of ant that exists in the hive
Output
first line : The size that can be created is S..B( Include ) The number of sets . image {1,2} Such a set and {2,1} It's the same , Should not be double counted . Print only the last... Of the number 6 position , front 6 Bit cannot have 0 Or space .
The sample input
3 5 2 3 1 2 2 1 3
Sample output
10
边栏推荐
- Yum command
- Web container basic configuration
- 六、HikariConfig的配置解析
- Tcp/ip test questions (4)
- Divine reversion EA
- DARKHOLE 2
- Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
- Process of vacuum and vacuum full
- PHP database connection version1.1
- Database data type design (the most detailed in the whole network)
猜你喜欢

Why are life science enterprises on the cloud in succession?

Trend ea- fixed stop loss and profit per order

How to quickly close port 8080

Web container basic configuration

Verification code native JS canvas

Jsonp processing non homologous

Jsonp function encapsulation

Use of serialize() and serializearray() methods for form data serialization

Bindgetuserinfo will not pop up

What is an operator?
随机推荐
QQ robot: self forbidden words management of group members [latest beta2 version]
Convert word to PDF through libreoffice
Applet canvas generate sharing Poster
rmi-registry-bind-deserialization
打新债证券开户安全吗
Kotlin compose terminate todo project Click to edit and modify todo
Vulnhub range - darkhole 1
请问同花顺开户安全吗?
Case: count the most characters and times
JQ implements tab switching
ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
MySQL prompt performance_ Schema missing table
Embark on a new journey and reach the world with wisdom
PostgreSQL change table owner
The meanings of /32, /48, /64 in IPv6 addresses
Verification code native JS canvas
Dependency injection in PHP reflection implementation framework
打新债网上开户安全吗,需要注意什么
PHP Chinese regular
Google cloud SSH enable root password login