| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 14877 | Custom English Word Sorting |
|
| 14878 | Tiling an L-Shaped Board with L-Trominoes |
|
Description
Write a program to sort n English words. An English word is defined as a sequence of at most m English letters. The ordering between English words must follow the rules below:
-
A shorter word appears before a longer word.
-
If two words have the same length, then the word with fewer uppercase letters appears before the one with more uppercase letters.
-
If two words have the same length and the same number of uppercase letters, then the word with fewer vowels appears before the word with more vowels.
Vowels include both uppercase and lowercase a, e, i, o, u. -
If the order is still undecided, use
strcmp().
The ordering must follow the rules above.
Parameter constraints:
0 < n ≤ 100000, 0 < m ≤ 80
Input
You are given n lines of input, each containing one English word.
The program must process all input until EOF.
Since n can be very large, please use qsort, not bubble sort.
For example,
This
Book
Keep
is
not
a
book
Output
Your output should contain n lines, each with one English word.
For example,
a
is
not
book
This
Book
Keep
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Write a program that uses four types of L-shaped trominoes to tile an L-shaped board completely. These L-shaped trominoes' size is 2 x 2 and labeled 1, 2, 3, 4, as shown in Figure 1.
The L-shaped board has even width and height.
The board’s full size is l × l, and the upper-right corner is removed with size m × m.
You must tile the entire L-shaped board by L-shaped trominoes without overlapping, and the trominoes must cover the board exactly. Please take a look at the example shown in Figure 2, where l = 8, m = 4.
Assume the origin (0, 0) is located at the lower-left corner.
Constraints: l and m are powers of 2, and 1 ≤ m < l ≤ 64.
Note that you have to consider the case that l is not equal to 2 x m.
Input
The input contains two numbers l and m.
Output
The output should list the types and positions of all L-shaped trominoes, respectively.
Since there are (l² − m²) / 3 trominoes, there should also be (l² − m²) / 3 lines in the output.
Each line represents one trominoe and contains three integers:
-
the tromino type (1–4),
-
the x-coordinate of the tromino’s center,
-
the y-coordinate of the tromino’s center.