USACO 2012 JAN (a title)
I, entitled Overview
Chinese title name |
gift |
Delivery route |
Game combos |
English title name |
gifts |
delivery |
combos |
Executable file name |
gifts |
delivery |
combos |
Enter the file name |
gifts.in |
delivery.in |
combos.in |
Output filename |
gifts.out |
delivery.out |
combos.out |
Each test point of time limit |
1 second |
1 second |
1 second |
The number of test points |
10 |
10 |
10 |
Each test point score |
10 |
10 |
10 |
Compare the way |
Compare the full text |
Compare the full text |
Compare the full text |
Second, run the memory limit
Run memory limit |
128 M |
128 M |
128 M |
Note: Thanks Hu full translation. [Error there, the statement is not so smooth ......]
1. gift {Bronze title 1}
【Problem Description】
FJ plans to use his B (1 <= B <= 1,000,000,000) dollars budget to his N (1 <= N <= 1000) cows gifts.
Gift of the purchase cost of cattle i P (i) yuan, delivery costs are S (i) yuan. FJ can buy half-price with a coupon as a gift, for a gift if i, then he spent on the total cost of this gift is P (i) / 2 + S (i), coincidentally, P (i) certain is an even number.
Calculate how many head of cattle FJ give up to give gifts.
[File Input]
The first line, two integers, are N and B.
First 2..N + 1 lines, each two integers, respectively, P (i) and S (i).
(0 <= P(i),S(i) <= 1,000,000,000)。
[File Output]
An integer, how many head of cattle up to FJ give gifts.
[Sample input]
5 24
4 2
2 0
8 1
6 3
12 5
[Sample Output]
4
[Sample Description]
Buy a gift 1 to 4, the coupon to 3 using (4 + 2) + (2 + 0) + (4 + 1) + (6 + 3) = 22, he may be a coupon in 1 or 4 .
2. fence paint {silver title 1}
【Problem Description】
FJ has N (1 <= N <= 100) farms, each having a separate farm integer coordinates (x_i, y_i). He needed a material distribution route, starting from a farm, passes through the Farm 1, Farm 2, Farm 3 ... and finally returned to the farm from the farm N 1.
FJ four directions can only travel towards the truck, not a traveling unit length 1 minute, in addition to a farm, and can only reach the other farms once.
Calculate the minimum time it takes FJ.
[File Input]
The first line, an integer N.
First 2..N + 1 lines, each two integers x_i and y_i (1 <= x_i, y_i <= 1,000,000).
[File Output]
Line, an integer that represents the minimum time spent. No solution outputs -1.
[Sample input]
4
2 2
2 4
2 1
1 3
[Sample Output]
12
[Sample Description]
FJ can be completed in 12 minutes, his delivery routes: 2 minutes, from the farm to farm 1-2; 5 minutes 2-3 farm farm (farm bypassing 1); 3 3 minutes to go from farm to farm 4; 2 minutes from Back farm 1 farm 4.
3. The game combos {Gold title 1}
【Problem Description】
Bessey playing a game that only three skill key "A" "B" "C" are available, but these types of bonds can be formed of N (1 <= N <= 20) a specific combos. The i-th combo with a length of 1-15 indicates a string S_i.
When a sequence of characters input, and when a Bessey combo matches, he will receive 1 point. Special, he enters a sequence of characters, and may also have a plurality of matching combos, for example N = 3, three kinds of combos are "ABA", "CB", and "ABACB", if the input Bessie "ABACB "he will get 3 points.
If the input is exactly Bessie K (1 <= K <= 1,000) characters, how many points he can get up to?
[File Input]
The first line, two integers N and K.
First 2..N + 1 lines, each string representing a combined technique.
[File Output]
Line, an integer representing the maximum score.
[Sample input]
3 7
ABA
CB
ABACB
[Sample Output]
4
[Sample Description]
Input ABACBCB, ABA 1 point, ABACB 1 point, CB 2 points.
Reproduced in: https: //www.cnblogs.com/jznoi/p/4149742.html