1207 exercises

Plant corn

Title description

Lelejia rented a piece of land outside the city to grow crops. He likes to go to the land in his spare time to grow vegetables and play. The corn planted in June this year, the corn stalks were already very high in October. Lele observed in general and found that some corn stalks were very tall, more than 200 cm, and some were very short, only a little more than 100 cm. He decided to make a statistic to calculate the difference between the highest corn stalk and the lowest corn stalk height.

"Corn stalk height difference" = highest corn stalk height-lowest corn stalk height.

Input format

The first row has two integers m and n. There are m rows and n columns for corn in a field.
Starting from the second row, there are m rows and each row has n numbers, indicating the height of each corn stalk (the height is an integer)

Output format

Output an integer, representing the difference between the highest corn stalk height and the lowest corn stalk height

Sample input

2 3
2 4 9
3 7 8

Sample output

7


Christmas tree

Title description

Although it will be another month before Christmas, Xiao Zhang is already looking forward to it. No, he has already started to draw a Christmas tree on his notebook. The Christmas tree he drew is composed of a triangular leaf and a straight trunk, such as a The Christmas tree on the 4th floor is shown below:

The leaves above are composed of 4 layers*, and the trunk below is composed of 4*. Xiao Zhang wants to draw a big Christmas tree, but he has no patience. You can use the programming knowledge you have learned to help him draw this tree ?

Input format

A number n, which means Xiao Ming wants to draw n layers of Christmas trees

Output format

Christmas tree look

Sample input

3

Sample output

Insert picture description here


Carefully selected

Title description

Xiao Wang is the warehouse manager of the company. One day, he received such a task: to find a steel pipe from the warehouse. This doesn't sound like a big deal, but the request for this steel pipe really made him difficult. The requirements are as follows:

1. This steel pipe must be the longest in the warehouse;
2. This steel pipe must be the thinnest of the longest steel pipes;
3. This steel pipe must be the one with the largest code among the first two steel pipes (each steel pipe All have a different code, the larger the production date, the closer).

Relevant information is available, but manually select the one that meets the requirements from hundreds of steel pipe materials... Or, please write a program to help him solve this problem.

Input format

The first line is an integer
N (1≤N≤1000), which represents the quantity of all steel pipes in the warehouse. After N lines, each line contains three integers, which respectively represent the length (in millimeters), diameter (in millimeters) and code (a 9-digit integer) of a steel pipe

Output format

A 9-digit integer representing the code of the selected steel pipe

Sample input

4
3000 50 872198442
3000 45 752498124
2000 60 765128742
3000 45 652278122

Sample output

752498124


King's Mirror

Title description

The king has a magic mirror that can double anything that touches the mirror surface-but because it is a mirror, the added part is the opposite. For example, we use AB to represent a necklace, and different letters represent pearls of different colors. If you touch the B end to the mirror surface, the magic mirror will turn this necklace into an ABBA. If you touch it with one end again, it will become ABBAABBA (assuming that the king only touches the magic mirror with one end of the necklace).
Given the final necklace, please write a program to output the minimum possible length of the initial necklace before the king did not use the magic mirror.

Input format

A string consisting of uppercase English letters, representing the output format of the final necklace. An integer representing the minimum possible length of the initial necklace before the king uses the magic mirror.

Sample input

ABBAABBA

Sample output

2


Guess you like

Origin blog.csdn.net/davidliule/article/details/110823298