We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #222: Sphere Packing

Project Euler #222: Sphere Packing

Problem
Submissions
Leaderboard
Discussions

What is the length of the shortest pipe, of internal radius , that can fully contain balls of radii where ?

Give your answer in micrometres ( ) rounded to the nearest integer.

Input Format

The first line of each test file contains two-separated integers and .
The next line contains space-separated integers .

Constraints

  • .
  • .
  • .
  • are pairwise distinct.

Output Format

Print your answer in one line.

Sample Input 0

2 1
2

Sample Output 0

4000

Sample Input 1

5 2
3 4

Sample Output 1

13325

Sample Input 2

100 5
61 62 63 64 65

Sample Output 2

530707

Author

khalid_t

Difficulty

Easy

Max Score

100

Submitted By

740

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy