# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11628 | Spiral |
|
13633 | Indentation |
|
14439 | The Snack Safe |
|
Description
SunMoon likes spiral(漩渦). On the N*N’s space, he starts moving into the left top corner, (0,0), and walking right for totally N steps (including the first movement into (0,0)). He then walks down for N-1 steps, then walks left for N-2 steps and then walks up for N-3 steps… until no more steps are possible. When he walks across that space, he will draw '#' on the floor. The others that he doesn’t pass will be ‘ ‘. Please tell SunMoon what the resulting spiral(漩渦) looks like.
Input
There is a positive number T(1 <= T <= 1000). It means that there are T numbers.
In next T lines, each line contains a positive number N(1 <= N <= 5000),which is the size of the space.
Output
Please show the resulting spiral(漩渦).
Note: The first step is to enter (0,0), and the second step is to enter (0,1)…and so on.
About the output format, please refer to sample output below, the download of sample output is not correct.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You're now in a bad mood since you quarreled with your best friend.
Recently, your best friend keeps convince you that using semicolons for indentation is the best way to code in C. He claimed that semicolons are beautiful, so you'll be in a good mood if you put a lot of semicolons in your code. What's more, you'll never forget to add a semicolon at the end of the line anymore. You think that your friend is insane and you have a severe headache every time you read his code.
Therefore, you decide to get rid of this terrible habit for your friend: now your friend is taking a nap, and you are going to open his computer, find his code files, and turn all of his code to space indentation.
Given lines of compilable C code. Currently, the code is indented by semicolons, and now you want to rewrite this code using spaces for indentation.
In other words, you are going to do the following operations:
- For every single line, turned every prefix semicolon into spaces.
- Add a semicolon at the end of every single line, except for the lines mentioned below:
- Header file included. e.g. #include <stdio.h>
- A line that contains '{' at the very end of it.
- A line that contains only semicolons and a single '}' at the end.
It is guaranteed that there are no other situations that don't need a semicolon at the end of the line.
Input
Lines of compilable C code, terminated by EOF.
Output
The code using space for indentation.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Yanami Anna asked Nukumizu Kazuhiko for help with losing her weight by locking all the snacks in a safe.(保險箱)To make sure her weight loss plan succeeded, Nukumizu came up with a special password generation method:
- Perform T operations on a string S of length N.
- Each operation shifts all characters from position L to position R forward by M positions. For example, moving 'a' forward by 3 results in 'd'.
If the movement exceeds 'z', it wraps around to 'a' (e.g., 'x' moved forward by 3 becomes 'a').
If we need to move back from 'a', it wraps around to 'z' (e.g., 'c' moved backward by 3 becomes 'z').
Unfortunately, after locking the safe, you realized your snacks were locked inside too! Luckily, Nukumizu recorded the password creation process. By following these steps in order, you can retrieve the password and save your snacks.
Input
The first line of input contains T, N and a string S of length N. T is ths number of operations, and the string S will only contain lowercase letters.
This is followed by T lines, each containing three numbers L , R and M , indicating that all characters from position L to position R in the string should be shifted by M positions.
Constraints
- 1 ≤ T, N ≤ 106
- -109 ≤ M ≤ 109
- 1 ≤ L ≤ R ≤ N
Subtasks
- Testcases 1 ~ 3: 1 ≤ T ≤ 1000
- Testcases 4 ~ 6: No additional restrictions.
Output
Output the string S after T operations.
Please remember to print "\n" at the end.