重点单词:
poke v.戳,刺,插入,张望。
fro adv.来回地,往复地
march v.进行,行军,进展。
出处:https://acs.jxnu.edu.cn/problem/NOIOPJCH02069289
[Usaco2005 Nov]Ant Counting
1000ms 131072K
描述:
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
Bessie 有一天在蚂蚁山洞前看蚂蚁前前后后地找食物。 他意识到许多蚂蚁都是兄弟姐妹,不能分清楚他们。 同时他
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
作为有一点数学头脑的Bessie开始思考。 Bessie注意到整个蚁群由T 组(1 <= T <= 1,000) 家庭组成,Bessie给每个家庭从1到T作上记号(总共有A只蚂蚁)。每一个家庭有Ni只家庭成员
(1 <= Ni <= 100) of ants.
How many groups of sizes S, S+1, ..., B (1 <= S <= B <= A) can be formed?
S到B只蚂蚁能组成多少个队伍?
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:
观察一组,由三个家庭组成的队伍被看做{1, 1, 2, 2, 3},即使很少会有这样的情况。 可能出去寻找食物的蚂蚁队伍如下:
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.
你的任务就是根据上面所给数据数出全部可能的蚂蚁组队情况;
输入:
* Line 1: 4 space-separated integers: T, A, S, and B
第一行: 4个用空格隔开的整数T,A,S,B.
* Lines 2..A+1: Each line contains a single integer that is an ant type present in the hive
第二行: 有A+1行:每一行包含一个整数代表蚂蚁所属的家庭;
输出:
* 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.
第一行:输出一个整数,表示当S到B(包括S和B)只蚂蚁出去觅食时,不同的组队方案数. 组合1,2和组合2,1是同一种组队方式,不能重复数。你只需要输出答案的最后6位数字.不要输出前导0以及多余的空格.