编程介的小学生
2017-10-26 01:31
采纳率: 92.5%
浏览 870
已采纳

HardDisk Drive

Problem Description
  Yesterday your dearcousin Coach Pang gave you a new 100MB hard disk drive (HDD) as a gift becauseyou will get married next year.
  But you turned on yourcomputer and the operating system (OS) told you the HDD is about 95MB. The 5MBof space is missing. It is known that the HDD manufacturers have a differentcapacity measurement. The manufacturers think 1 “kilo” is 1000 but the OSthinks that is 1024. There are several descriptions of the size of an HDD. Theyare byte, kilobyte, megabyte, gigabyte, terabyte, petabyte, exabyte, zetabyteand yottabyte. Each one equals a “kilo” of the previous one. For example 1gigabyte is 1 “kilo” megabytes.
  Now you know the size ofa hard disk represented by manufacturers and you want to calculate thepercentage of the “missing part”.
Input
  The first line containsan integer T, which indicates the number of test cases.
  For each test case,there is one line contains a string in format “number[unit]” where number is apositive integer within [1, 1000] and unit is the description of size whichcould be “B”, “KB”, “MB”, “GB”, “TB”, “PB”, “EB”, “ZB”, “YB” in shortrespectively.
Output
  For each test case,output one line “Case #x: y”, where x is the case number (starting from 1) andy is the percentage of the “missing part”. The answer should be rounded to twodigits after the decimal point.
Sample Input
2
100[MB]
1[B]
Sample Output
Case #1: 4.63%
Case #2: 0.00%

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • threenewbee 2017-11-09 07:42
    已采纳
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题