Number of folders——文件夹的数量
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
Timothy was an extraordinary visionary! In a short period of time, he conceived a vast number of web pages and made significant contributions to JSUT's Online Judge. However, the sheer number of directories in JSUT's Online Judge made it difficult for his assistant, Paper, to keep up. This was due to the sheer number of folders required, some of which were nested within folders. These folders are represented using Unix paths, for example: indicates that under the root directory , there is a folder named , which in turn contains a folder named , which in turn contains a folder named .
Currently, the root directory[1] is empty. Timothy has a lot of folder path names in mind. The question is, how many folders should he create to ensure they all exist?
Input
The first line is a positive integer .
The next lines, each line is a string describing the path, and the length of does not exceed .
Output
The output should contain lines, each containing positive integers. The th line outputs the minimum number of new folders that need to be created in order for the st path to the th path to exist.
Samples
2
/jsut/application/controller
/jsut/application/view
3
4
3
/chicken
/chicken/egg
/chicken
1
2
2
4
/a
/a/b
/a/c
/b/b
1
2
3
5
Notes
The first character of each path is always , there are no two consecutive , and the last character is not . All names contain only digits and lowercase letters.
Linux and other Unix-like operating systems use Posix paths, where folder paths are separated by forward slashes /, with the first / representing the root directory ↩︎
2025 JSUT Collegiate Programming Contest 江苏理工学院新生赛-同步赛
- 状态
- 已结束
- 规则
- ACM/ICPC
- 题目
- 15
- 开始于
- 2025-11-8 12:00
- 结束于
- 2025-11-8 17:00
- 持续时间
- 5 小时
- 主持人
- 参赛人数
- 15