填空题

Manipulate Inodes

发布于 2022-03-03 17:21:30

    Given a list of bash commands to manipulate folders/files. Can you answer the results of a list of existence checking?

    Suppose we are under the empty root folder ‘/’. The commands include: mkdir [-p], touch and rm [-r], which are all BSD general commands. If you are not familiar with them, refer to command explanations (备注) after the output example. If the command cannot be executed correctly, just ignore this command.

    The questions are existFile or existFolder, which are described as below. A valid path can either be a file or folder, not both.
existFile path
    Check whether a file specified by path exists. Output ‘true’ if file exists, ‘false’ otherwise.
existFolder path
    Check whether a folder specified by path exists. Output ‘true’ if folder exists, ‘false’ otherwise.
输入描述:

The first line contains two integers m(1  m  1000) and n((1  n  100) – the number of commands and questions separately.The following m lines are the commands, followed by n lines of questions.

输入样例: 4 2 mkdir -p a/b/c mkdir a/b/c/d/e touch file1 rm -r a/b existFolder /a/b existFile /file1 输出描述: For each question, output “true” if the file/folder
exists or “false” otherwise.输出样例 false true
关注者
0
被浏览
3
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看