# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13339 | Karpet Ribet |
|
13418 | Final version |
|
13421 | Camo the Train Conductor |
|
Description
Ribet means complicated in Indonesian. This problem can be solved with recursion, similar to Sierpinski.
RH, a green sock, loves programming and overcomplicating things.
After finishing Sierpinski's Carpet, he think that it was way too simple, So he designed a cooler looking carpet and named it Karpet Ribet.
The square in the center should be of length 8 units.
The construction is decribed as follow.
For a Carpet that has depth 1, consists of 1x1 square colored black.
For depth 2, it has side length 4, its 4 corners are made up of depth 1 Carpet with a 2x2 center square.
For depth 3, it has side length 10, its 4 corners are made up of depth 2 Carpet with a 4x4 center square.
For carpet with depth of n, its 4 corners are made up of depth (n-1) carpet with a 2n-1 center square.
For a clear picture, the following figures are the carpet with Depth 1, 2, and 3.
The following figure is the carpet with depth 5.
The square in the center should be of length 16 units.
Input
Input contains only one line with single integer n (1 <= n < 12).
Output
Output the carpet with depth n and use ' ' (space) to represent white, '*' to represent black.
Remember to add a newline character at the end of line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
There is an important skill called "version control" that we must learn.
The first step to be the master of version control is ── naming the files.
To make you remember how many times you modify the files, you decide to write down the version number in your file names, e.g. I2P(I)2021_Hu_problem_final_V2.c .
However, using the Arabic numerals is not cool enough so you decide to transfer the Arabic numerals into Roman numerals.
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2
is written as II
in Roman numeral, just two one's added together. 12
is written as XII
, which is simply X + II
. The number 27
is written as XXVII
, which is XX + V + II
.
Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII
. Instead, the number four is written as IV
. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX
. There are six instances where subtraction is used:
I
can be placed beforeV
(5) andX
(10) to make 4 and 9.X
can be placed beforeL
(50) andC
(100) to make 40 and 90.C
can be placed beforeD
(500) andM
(1000) to make 400 and 900.
Please design the program so that you can become a super-coooooooool engineer.
Input
An integer N (1<=N<=3999) implies the origin Arabic numerals.
Output
The transfered Roman numerals represented in strings.
Note that you need to print a newline character in the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Camo is a train conductor, she wants to adjust the train he's driving.
There are six instructions below with the description:
You don't need to implement red instructions which are done by Domo!
1. AddFront num
Add a train carriage with the index num in front of the train.
2. AddBack num
Add a train carriage with the index num in back of the train.
3. Delete num
Delete all the train carriages with the index num from the train. (If the train has no any carriage with the index num, do nothing)
4. DeleteFront
Delete the first element of the train. (If the train is empty, do nothing)
5. DeleteRange num1 num2
Delete carriages between the num1-th carriage and the num2-th carriage (Start counting from 1, if the given range is out of the bound, do nothing.)
6. Swap
Reverse all train carriages. (If the train is empty, do nothing)
For example:
AddFront 5 makes the train [4, 1] become [5, 4, 1].
AddBack 5 makes the train [4, 1] become [4, 1, 5].
Delete 5 makes the train [5, 4, 1, 5, 3] become [4, 1, 3].
DeleteFront make the train [1, 2, 3, 4] become [2, 3, 4].
DeleteRange 2 4 make the train [6, 5, 4, 3, 2, 1] become [6, 2, 1].
* Example 2: DeleteRange 2 4 will not affect the train [1, 2, 3] (since the index 4 is invalid)
* Example 3: DeleteRange 0 2 will not affect the train [1, 2, 3] (since the index 0 is invalid).
Swap makes the train [2, 6, 3] become [3, 6, 2].
The train is empty in the beginning. Given a series of instructions, please print the index of train carriages after all instructions are executed.
This is a partial judge problem, you're asked to implement 3 functions.
Hint: You can use the Print function to debug!
Input
The input consists of multiple instructions (1 ≤ number of instructions ≤ 105)
the index of each carriage is a positive integer and not greater than 102.
the num1 and the num2 (num1 ≤ num2) of the DeleteRange instruction are guaranteed two integers.
Output
The output only consists of a line denoting the train carriage indices after all the instructions.
It's guaranteed that the output consists of at least one carriage.