HOJ1941 超市收银问题
超市收银问题
L最近在工大外面开了一个小超市。由于该超市物美价廉,且服务态度热情,因此刚开业就十分火爆。可是,这个超市目前只有两个收银台,以至于最近经常有顾客抱怨等待交款的时间太长。
这个超市目前暂时没有办法增加新的收银台,因此,L想通过别的办法缓解这个问题。现在,假设有N个顾客在等待交款。显然,前两个顾客可以马上得到服务,而后面的就得排队等候。L想重新调整一下两支队伍,使得这N个顾客们的平均等待时间最小。假设这N个顾客交完费之前不会来新的顾客。请你帮他完成这个任务。
SOJ1824 The Suspects
URL: SOJ1824
Description
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others.
In the Not-Spreading-Your-Sickness University (NSYSU), there are many student groups. Students in the same group intercommunicate with each other frequently, and a student may join several groups. To prevent the possible transmissions of SARS, the NSYSU collects the member lists of all student groups, and makes the following rule in their standard operation procedure (SOP).
Once a member in a group is a suspect, all members in the group are suspects.
However, they find that it is not easy to identify all the suspects when a student is recognized as a suspect. Your job is to write a program which finds all the suspects.
POJ1185 炮兵阵地
POJ1182 食物链
URL : POJ 1182
Description
1 | 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 |
Codeforces Round #245 (Div. 1) A /(Div.2 C) Xor-tree
Xor-tree
Iahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for kids which uses xor-trees.
The game is played on a tree having n nodes, numbered from 1 to n. Each node i has an initial value initi, which is either 0 or 1. The root of the tree is node 1.
One can perform several (possibly, zero) operations on the tree during the game. The only available type of operation is to pick a node x. Right after someone has picked node x, the value of node x flips, the values of sons of x remain the same, the values of sons of sons of x flips, the values of sons of sons of sons of x remain the same and so on.
The goal of the game is to get each node i to have value goali, which can also be only 0 or 1. You need to reach the goal of the game by using minimum number of operations.
Codeforces Round #243 (Div. 1) C Sereja and Two Sequences
Sereja and Two Sequences
sereja has two sequences a1, a2, …, an and b1, b2, …, bm, consisting of integers. One day Sereja got bored and he decided two play with them. The rules of the game was very simple. Sereja makes several moves, in one move he can perform one of the following actions:
- Choose several (at least one) first elements of sequence a (non-empty prefix of a), choose several (at least one) first elements of sequence b (non-empty prefix of b); the element of sequence a with the maximum index among the chosen ones must be equal to the element of sequenceb with the maximum index among the chosen ones; remove the chosen elements from the sequences.
2. Remove all elements of both sequences.
The first action is worth e energy units and adds one dollar to Sereja’s electronic account. The second action is worth the number of energy units equal to the number of elements Sereja removed from the sequences before performing this action. After Sereja performed the second action, he gets all the money that he earned on his electronic account during the game.
Initially Sereja has s energy units and no money on his account. What maximum number of money can Sereja get? Note, the amount of Seraja’s energy mustn’t be negative at any time moment.
Codeforces Round #243 (Div. 1) A Sereja and Swaps
题目描述
A. Sereja and Swaps
As usual, Sereja has array a, its elements are integers: a[1],a[2],...,a[n]. Let’s introduce notation:
$$
f \left( a, l, r \right) = \sum_{i=l}^{r} a \left[ i \right]; \ m \left( a \right) = \underset{1 \leq l \leq r \leq n}{max} f \left( a, l, r \right)
$$
A swap operation is the following sequence of actions:
- choose two indexes
i, j (i ≠ j); - perform assignments
tmp = a[i], a[i] = a[j], a[j] = tmp.
