USACO translation: USACO 2014 JAN Three Issues (2)

USACO JAN 2014

I, entitled Overview

Chinese title name

Team balance

Ski Video

Ski construction

English title name

bteams

recording

skicourse

Executable file name

bteams

recording

skicourse

Enter the file name

bteams.in

recording.in

skicourse.in

Output filename

bteams.out

recording.out

skicourse.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. Team equilibrium {Bronze title 3}

【Problem Description】

The participating farmers John 12 cows were divided into four groups, each group 3, the skill level of each cow is an integer between 1 to 000,000. He hoped that the sum of the value of the skills of each group try to balance that group and the largest gap between the sum of the minimum set of skills to the skills of the sum as small as possible. Please calculate the absolute value of the minimum gap.

[File Input]

The first 1..12 lines, each an integer that represents the value of the skills of cattle.

[File Output]

   The output common line, an integer that represents the absolute value of the minimum gap.

[Sample input]

1

2

3

4

5

6

7

8

9

10

11

12

[Sample Output]

1

[Sample Description]

(12,1,7), (9,8,3), (10,5,4), (11,2,6). Maximum 20, minimum 19.

2. Ski video {silver title 3}

【Problem Description】

   Winter television schedule comprising N (1 <= N <= 150) programs, each program has a start and end time. Farmer John have two recorders, please calculate how many programs can record up to him.

[File Input]

The first line, an integer N.

The next two integer N lines per row, indicating the start and end times of a program, the range 0..1,000,000,000.

[File Output]

An integer representing the largest number of programs that can be recorded.

[Sample input]

6

0 3

6 7

3 10

1 5

2 8

1 9

[Sample Output]

4

[Sample Description]

The first recorded program table 1 and 3, the second station 2 and record the program 4.

3. Ski construction {Gold title 2}

【Problem Description】

Ski design is a M * NM x N (1 <= M, N <= 100) matrix, each of the grid with a letter R (rough representation) or S (represented flat).

such as:

RSRSSS

RSRSSS

RSRSSS

     Farmer John each tractor can be a B * B (B <= M, B <= N) of all the region marked B * B (B <= M, B <= N), R or S, B can he wants as large as possible. A grid may be marked a plurality of times, the next time mark before the mark can be covered, each grid may have at least one marker.

[File Input]

The first line, two spaces separated by an integer, respectively, M, N.

Next, 2 .. M + 1 lines, each symbol of the M, R or S. As represented by the reference target state.

[File Output]

    A total line, an integer that represents the maximum value B.

[Sample input]

3 6

RSRSSS

RSRSSS

RSRSSS

[Sample Output]

3

[Sample Description]

First, the first to mark all three R, and the second to all four labeled S, the first next 3-5 all labeled R, and finally the first 4-6 all labeled S.

 

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

Guess you like

Origin blog.csdn.net/weixin_34220623/article/details/93292287