USACO translation: USACO 2014 JAN Three Issues (1)

USACO JAN 2014

I, entitled Overview

Chinese title name

Ski Design

Ski deceleration

Ski Ratings

English title name

ski design

slowdown

skilevel

Executable file name

ski design

slowdown

skilevel

Enter the file name

skidesign.in

slowdown.in

skilevel.in

Output filename

skidesign.out

slowdown.out

skilevel.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

256 M

256 M

256 M

 

1. ski design {Bronze title 1}

【Problem Description】

     Farmer John designed ski N (1 <= N <= 1,000) block mountain, the mountain height of each block is an integer in the range 0 .. 100. Ski design specifications require the highest height of the mountain and the lowest difference between the mountain can not be more than 17, so he may need to lower or raise some mountain, flower X ^ 2 fee can change the value of the height X of a mountain, find The minimum cost.

[File Input]

The first line an integer N.

Next 2..N + 1 lines, each an integer that represents the height of a mountain.

[File Output]

   The output common line, an integer that represents the minimum cost.

[Sample input]

5

20

4

1

24

21

[Sample Output]

18

[Sample Description]

Maintaining constant height of 4,2,21; the height of 1 to a 4 at a cost of 9; the height of 24 to 21 at a cost of 9, 18 of the total cost of the cost.

 

2. Ski deceleration {silver title 1}

【Problem Description】

    Bessie the cow to participate in a total distance of 1,000 meters in the ski race, her initial speed of 1 meter per second, when the speed becomes 1/2 meters per second when she first slow down, slow down to 1 second / 3 meters per second, and so on.

Now the event is given deceleration point two kinds of:

T 17 (17 seconds at deceleration)

D 10 (deceleration at distance of 10 m)

We are now given N (1 <= N <= 10,000) pieces of event point, her calculated completion time. Your answer will be rounded to the nearest whole number (rounded to the nearest 0.5 1).

[File Input]

The first line, an integer N.

Next N lines of a point event. Format is "T x" or "D x".

x is an integer, and ensure that this event point, she had at least 1 meter slide;

If more time is simultaneous, she also will slow down many times.

Event points might be out of order.

[File Output]

An integer representing the total time taxiing.

[Sample input]

2

T 30

D 10

[Sample Output]

2970

[Sample Description]

After a speed of 1 meter per second slide of 10 meters, drop of 1/2 meters per second, it took 20 seconds to slide the next 10 meters, then slow down to 1/3 meters per second, sliding the rest of the 980 m takes 2940 seconds. The total time spent 10 + 2940 + 20 = 2970.

3. Ski rating {Gold title 3}

【Problem Description】

   Ski altitude represented by a M * N (1 <= M, N <= 500) matrix of numbers, each number represents the height in a range of 0 .. 1,000,000,000. Some grid is designated as a starting point, the organizers would like to do Difficulty rating on the starting point.

If the point P is a starting point for the level of difficulty starting point D, then D must be a minimum of the following conditions are met:

(1) can slide from one adjacent lattice grid;

(2) difference in elevation of not more than two lattice D;

(3) capable of at least reach the T (1 <= T <= M * N) lattice (including the starting point itself).

[File Input]

The first line, separated by a space of three integers, respectively, M, N and T.

Next, 2 .. M + 1 lines, each of the N integers representing altitude.

Next M + 2 .. 2M + 1 lines, each an integer of 0 or 1, where 1 indicates that the grid is a starting point.

[File Output]

    Total row, an integer, and the starting point of all difficulty.

[Sample input]

3 5 10

20 21 18 99 5

19 22 20 16 17

18 17 40 60 80

1 0 0 0 0

0 0 0 0 0

0 0 0 0 1

[Sample Output]

24

[Sample Description]

The upper left corner of the grid points are together, the difficulty is 4, the lower right corner of the grid is a starting point, the difficulty is 20.

 

Reproduced in: https: //www.cnblogs.com/jznoi/p/4071616.html

Guess you like

Origin blog.csdn.net/weixin_34311757/article/details/93143282