UVa 400

From Algorithmist
Jump to navigation Jump to search


400 - Unix ls[edit]

Summary[edit]

Sort and output a list of filenames in the format given.

Explanation[edit]

  1. Determine how long the longest filename is.
  2. Determine how many columns/rows you must have.
  3. Output each row as specified in the problem.

Notes[edit]

  • This is very similar to the UNIX ls command; and hence the title.
  • Don't fret if you get PE instead of AC; the spaces are notoriously difficult to get correct.

Input[edit]

5
koala.jpg
australia.exe
kangaroo.txt
foo.bar
homer.simpson
2
www.algorithmist.com
acm.uva.es

Output[edit]

------------------------------------------------------------
australia.exe  homer.simpson  koala.jpg    
foo.bar        kangaroo.txt   
------------------------------------------------------------
acm.uva.es            www.algorithmist.com