Statistics

Problem Statement for "Ellys8Bit"

Problem Statement

"Pravetz" is a well-known brand of computers in Bulgaria, as the company used to manufacture all 8-bit computers in the country during the socialism. Suddenly, after a 20-year pause from being on the market, they released a modern, 64-bit laptop.

Elly recently bought such a laptop and now her mother is confused. How can an 8-bit computer be also 64-bit!? Elly, always being pain in the assembler, decided to joke with her by coming up with the following definition: "A 64-bit 8-bit number with at most 64 bits in its binary representation, which has exactly 8 bits set. (I.e., out of the 64 bits there are exactly eight 1s.)". By this definition, the first few such numbers are 255, 383, 447, 479, etc.

Elly told her mother that, in order to be in line with the new technologies, she has to be able to calculate these numbers by heart. To her surprise, she actually started doing so. Now the girl wants to check whether her calculations are correct.

Your task is simple: given an int N, return the N-th 64-bit 8-bit number.

Definition

Class:
Ellys8Bit
Method:
getNumber
Parameters:
int
Returns:
long
Method signature:
long getNumber(int N)
(be sure your method is public)

Constraints

  • N will be between 1 and 1,000,000,000, inclusive.

Examples

  1. 1

    Returns: 255

    The first 64-bit 8-bit number is just the binary number 11111111, which is 255 in decimal.

  2. 2

    Returns: 383

    The second 64-bit 8-bit number is 101111111, which is 383 in decimal.

  3. 3

    Returns: 447

    The third 64-bit 8-bit number is 110111111, which is 447 in decimal.

  4. 1000

    Returns: 7032

    The thousandth 64-bit 8-bit number is 1101101111000, which is 7032 in decimal.

  5. 133742

    Returns: 1087088

  6. 537655880

    Returns: 1125899983585796

    Watch out for overflows!

  7. 666

    Returns: 5527

  8. 1337

    Returns: 8911

  9. 4266642

    Returns: 480321552

  10. 10000000

    Returns: 3225424112

  11. 1234567

    Returns: 36454435

  12. 9876543

    Returns: 2973794436

  13. 1337666

    Returns: 42035840

  14. 6661337

    Returns: 1158680625

  15. 421337

    Returns: 5587714

  16. 3333333

    Returns: 274728593

  17. 9999999

    Returns: 3225424104

  18. 7171717

    Returns: 1358955114

  19. 5555555

    Returns: 809568518

  20. 97531

    Returns: 667393

  21. 24680

    Returns: 133479

  22. 1287644

    Returns: 38486112

  23. 123456789

    Returns: 4415227629056

  24. 666666666

    Returns: 2256474084483200

  25. 999999999

    Returns: 10520127258763776

  26. 1000000000

    Returns: 10520127258764288

  27. 795755685

    Returns: 4523459959357440

  28. 581869303

    Returns: 1152709093294080

  29. 404620563

    Returns: 285873132800002

  30. 708632712

    Returns: 2430470455361544

  31. 545404205

    Returns: 1125968659877448

  32. 133711906

    Returns: 4947936610640

  33. 372047868

    Returns: 212210593038592

  34. 949333986

    Returns: 9147936752800769

  35. 579004999

    Returns: 1144325316550680

  36. 323567404

    Returns: 140808358596736

  37. 418932836

    Returns: 299616918571793

  38. 944672732

    Returns: 9079801382461448

  39. 196140741

    Returns: 18691773175856

  40. 809094427

    Returns: 4574254003662848

  41. 946129058

    Returns: 9086366306545665

  42. 30574577

    Returns: 68730749970

  43. 182506778

    Returns: 17605272277025

  44. 15198493

    Returns: 8871154176

  45. 150802600

    Returns: 8813550242320

  46. 138749191

    Returns: 5566822875284

  47. 676943010

    Returns: 2269433070387712

  48. 177512688

    Returns: 17592195124480

  49. 126303054

    Returns: 4453881155841

  50. 81133258

    Returns: 1106495160325

  51. 183966551

    Returns: 17626545856905

  52. 471852627

    Returns: 564135365444228

  53. 84672537

    Returns: 1138837684296

  54. 867128744

    Returns: 6193626308673556

  55. 857788837

    Returns: 5633898117644354

  56. 275731772

    Returns: 70717727068160

  57. 609397213

    Returns: 1337015031373824

  58. 20544910

    Returns: 18421776528

  59. 811450930

    Returns: 4578367357845536

  60. 483031419

    Returns: 570096779166464

  61. 361913171

    Returns: 175991125262340

  62. 547204602

    Returns: 1126037346355242

  63. 892462744

    Returns: 9007218584585220

  64. 522136404

    Returns: 738872350941216

  65. 173978710

    Returns: 13262875822656

  66. 131752569

    Returns: 4679924973568

  67. 478582453

    Returns: 567349079539712

  68. 867889991

    Returns: 6267216278650896

  69. 153380496

    Returns: 8864812859413

  70. 551745921

    Returns: 1126260952564225

  71. 647984700

    Returns: 2251941549245441

  72. 910208077

    Returns: 9009415492517890

  73. 283496852

    Returns: 72567771783188

  74. 368550363

    Returns: 211106928787984

  75. 379821990

    Returns: 281476356636707

  76. 712568903

    Returns: 2533348878584384

  77. 40498239

    Returns: 138116988944

  78. 113911604

    Returns: 3028155367440

  79. 103237637

    Returns: 2237712695432

  80. 39073007

    Returns: 137465299138

  81. 684602223

    Returns: 2287122229248008

  82. 812852787

    Returns: 4583866811547648

  83. 479711181

    Returns: 567382930100229

  84. 746745228

    Returns: 3449339909243392

  85. 735241235

    Returns: 3096242997446912

  86. 296707007

    Returns: 79731781281796

  87. 262522458

    Returns: 70369281583874

  88. 870676136

    Returns: 6755536888987714

  89. 136721027

    Returns: 5497559418888

  90. 359573809

    Returns: 168233868998656

  91. 189375153

    Returns: 17768564916296

  92. 547914047

    Returns: 1126039493317776

  93. 198304613

    Returns: 18829406144576

  94. 640439653

    Returns: 2251804243656872

  95. 417177802

    Returns: 299085684813828

  96. 25475624

    Returns: 35165062465

  97. 758242872

    Returns: 4503616945799236

  98. 764919655

    Returns: 4503806465542144

  99. 310701088

    Returns: 106944694587392

  100. 361931892

    Returns: 175991654253120

  101. 100000000

    Returns: 2207646765712

  102. 12345

    Returns: 60940


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: