04. Photo Gallery - int to B,KB,MB
Здравейте!
Имам затруднения в решаването на задата,по точно в превръщането на int към B,KB,MB
//----------Задачата----------//
Problem 1.Photo Gallery
Write a program, which receives image metadata as input and prints information about the image, such as its filename, date taken, size, resolution and aspect ratio. Also, calculate the orientation of the image. The 3 orientations are: portrait, landscape and square.
Input
- First line – the photo’s number – an integer in the range [0…9999]
- Second, third, fourth line – the day, month and year the photo was taken – integers forming valid dates in the range [01/01/1990…31/12/2020]
- Fifth, sixth line – the hours and minutes the photo was taken – integers in the range [0…23]
- Seventh line – the photo’s size in bytes – integer in the range [0…999000000]
- Eighth, ninth line – the photo’s resolution (width and height) in pixels – integers in the range [1…10000]
Output
- The name should be printed in the format “DSC_xxxx.jpg”.
- The date and time taken should be printed in the format “dd/mm/yyyy hh:mm”.
- The size should be printed in standard human-readable format (i.e. 950 bytes = 950B, 500000 bytes = 500KB, 1500000 bytes = 1.5MB).
- The resolution should be printed in the following format: “{width}x{height}”.
- The orientation can be one of three valid values: portrait, landscape and square.
Examples
Input |
Output |
|
Input |
Output |
35 25 12 2003 12 3 1500000 5334 3006 |
Name: DSC_0035.jpg Date Taken: 25/12/2003 12:03 Size: 1.5MB Resolution: 5334x3006 (landscape) |
533 20 3 1993 11 33 350000 768 1024 |
Name: DSC_0533.jpg Date Taken: 20/03/1993 11:33 Size: 350KB Resolution: 768x1024 (portrait) |