当前位置:网站首页>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
边栏推荐
- On Oracle full stack virtual machine -- graalvm
- PHP FPM, workman, spoole, golang simple performance test
- 一、HikariCP获取连接流程源码分析一
- Verification code native JS canvas
- 通过启牛学堂开的股票账户可以用吗?资金安全吗?
- Wechat applet swiper simple local picture display appears large blank
- JS asynchronism (I. asynchronous concept, basic use of web worker)
- Print 1 cute every 100 milliseconds ~ with a running lantern effect
- Sorting out the latest data mining competition scheme!
- ActiveMQ--CVE-2016-3088
猜你喜欢

Mail monitoring cloud script execution progress

Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)

Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system

Print 1 cute every 100 milliseconds ~ with a running lantern effect

SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?

Thymleaf template configuration analysis

Jsonp function encapsulation

Google cloud SSH enable root password login

2020-12-09 laravel . Env file loading mechanism process

Trend ea- fixed stop loss and profit per order
随机推荐
Bindgetuserinfo will not pop up
mysql load data infile
Elastic high-performance computing on the cloud supports the rapid development of the life science industry, reducing costs and increasing efficiency
一、HikariCP获取连接流程源码分析一
1、 Hikaricp source code analysis of connection acquisition process I
Install spoole
Vulnhub range the planes:earth
R language plot visualization: plot visualization of two-dimensional histogram contour (basic 2D histogram contour)
ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
QQ robot: self forbidden words management of group members [latest beta2 version]
Case: count the most characters and times
Applet password input box
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
Guangzhou Sinovel interactive creates VR Exhibition Hall panoramic online virtual exhibition hall
Suddenly found that the screen adjustment button can not be used and the brightness can not be adjusted
在打新债开户证券安全吗?低佣金靠谱吗
What is an operator?
Applet request interface encapsulation
Yaml configuration
Process of vacuum and vacuum full