ผลต่างระหว่างรุ่นของ "01204212/statuses"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
| แถว 4: | แถว 4: | ||
* First line: integer ''n'' (the number of comments) | * First line: integer ''n'' (the number of comments) | ||
| − | * The next ''n'' lines, each line specify a comment. Line ''i + 1'' for ''1<=i<=n'' specifies the ''i''-th comment. In this line, there is an integer ''p'' and a string ''s'' (consiting of a - z and an underline (_) whose length is at most 30). This comment replies to the ''p''-th comment. If ''p''=0, this comment replies to the status itself. The string ''s'' is the comment text. | + | * The next ''n'' lines, each line specify a comment. Line ''i + 1'' for ''1<=i<=n'' specifies the ''i''-th comment. In this line, there is an integer ''p'' (''p'' < ''i'') and a string ''s'' (consiting of a - z and an underline (_) whose length is at most 30). This comment replies to the ''p''-th comment. If ''p''=0, this comment replies to the status itself. The string ''s'' is the comment text. |
'''Input example''' | '''Input example''' | ||
| + | |||
| + | <pre> | ||
| + | 7 | ||
| + | 0 hello_world | ||
| + | 0 this_is_another_comment | ||
| + | 1 first_reply | ||
| + | 2 good_morning_thailand | ||
| + | 1 second_one | ||
| + | 1 third_one | ||
| + | 5 when_it_is_ok | ||
| + | </pre> | ||
| + | |||
| + | For this input, the expected report would be (see the description of the output at the end): | ||
| + | |||
| + | <pre> | ||
| + | - 1 hello_world | ||
| + | - 3 first_reply | ||
| + | - 5 second_one | ||
| + | - 7 when_it_is_ok | ||
| + | - 6 third_one | ||
| + | - 2 this_is_another_comment | ||
| + | - 4 good_morning_thailand | ||
| + | </pre> | ||
รุ่นแก้ไขเมื่อ 06:43, 17 สิงหาคม 2559
You are given an information on comments are posted. You want to print out a report on that in a nicely form.
Input
- First line: integer n (the number of comments)
- The next n lines, each line specify a comment. Line i + 1 for 1<=i<=n specifies the i-th comment. In this line, there is an integer p (p < i) and a string s (consiting of a - z and an underline (_) whose length is at most 30). This comment replies to the p-th comment. If p=0, this comment replies to the status itself. The string s is the comment text.
Input example
7 0 hello_world 0 this_is_another_comment 1 first_reply 2 good_morning_thailand 1 second_one 1 third_one 5 when_it_is_ok
For this input, the expected report would be (see the description of the output at the end):
- 1 hello_world
- 3 first_reply
- 5 second_one
- 7 when_it_is_ok
- 6 third_one
- 2 this_is_another_comment
- 4 good_morning_thailand