bonus1 - size > 0 is the integer size of the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Bonus 1: Directory Listing http://acm.zju.edu.cn/show_problem.php?pid=1635 Judge Compiler: gcc/g++ version 3.3.1 on Linux Given a tree of UNIX directories and file/directory sizes, you are supposed to list them as a tree with proper indention and sizes. Input Specification: The input consists of several test cases. Each case consists of several lines which represent the levels of the directory tree. The first line contains the root file/directory. If it is a directory, then its children will be listed in the second line, inside a pair of parentheses. Similarly, if any of its children is a directory, then the contents of that directory will be listed in the next line, inside a pair of parentheses. The format of a file/directory is: name size or *name size where name , the name of the file/directory, is a string of no more than 10 characters;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: size > 0 is the integer size of the file/directory; * means the name is a directory. It is guaranteed that name will not contain characters '(', ')', '[', ']', and ' * '. There are no more than 10 levels for each case, and no more than 10 files/directories on each level. Output Specification: For each test case, list the tree in the format shown by the sample. Files/directories that are of depth d will have their names indented by 8 d spaces. Do NOT print tabs to indent the output. The size of a directory D is the sum of the sizes of all the files/directories in D, plus its own size. Sample Input: */usr 1 (*mark 1 *alex 1) (hw.c 3 *course 1) (hw.c 5) (aa.txt 12) */usr 1 () Sample Output: ( represents a space) |_*/usr[24] |_*mark[17] | |_hw.c[3] | |_*course[13] | |_aa.txt[12] |_*alex[6] |_hw.c[5] |_*/usr[1]...
View Full Document

This note was uploaded on 02/16/2011 for the course CS 135 taught by Professor Yuechen during the Fall '08 term at Zhejiang University.

Page1 / 2

bonus1 - size > 0 is the integer size of the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online