Advertisement
Guest User

Untitled

a guest
May 11th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. Problem 4. Files
  2. You are given number of files with their full file paths and file sizes. You need to print all file names with a given extension that are present in a given root directory sorted by their file size in descending order. If two files have same size, order them by alphabetical order.
  3. If a file name (file name + extension) appears more than once in a given root, save only its latest value. If a file name appears in more than one root, they are treated as different files.
  4. If there aren't any files that correspond to the query, print "No".
  5. Input / Constrains
  6. • On the first line of input you will get N the number of files to be read from the console
  7. • On the next N lines, you receive the actual files in the format "root\folder\filename.extension;filesize"
  8. • There may be more than one folder e.g. files can be deeply nested
  9. • On the last line you receive a query string in format "{extension} in {root}". You need to print all files with the given extension that are in present in the given root
  10. Output
  11. • You need to print all files sorted by their size in descending order.
  12. • If two files have the same size, order them by alphabetical order.
  13. • Files should be printed in the given format "filename.extension - filesize KB"
  14. • If there aren't any movies that correspond to the query, print "No".
  15. Examples
  16. Input Output
  17. 4
  18. Windows\Temp\win.exe;5423
  19. Games\Wow\wow.exe;1024
  20. Games\Wow\patcher.cs;65212
  21. Games\Pirates\Start\keygen.exe;1024
  22. exe in Games keygen.exe - 1024 KB
  23. wow.exe - 1024 KB
  24.  
  25. 3
  26. C:\Documents\01. problems.docx;6521
  27. D:\Documents\02. Documents\ presentation.pptx;44234
  28. E:\Movies\Classics\someclassicmovie.avi;6221235212
  29. docx in E: No
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement