Since no one has posted a "good quality question" recently, i feel it is my duty to...
You work at an electronics company in the design department. The designers that work with you have asked you to make a program that will calculate the optimum configuration of pins on a microchip they are designing. With your ninja golfing skills, you are confident you can handle it.
Your company also has these requirements for each chip:
- The chips your company makes are known as TQFP, they have pins on each edge, but none in the middle.
- Each chip must be square, and have the same number of pins on each side.
- If the chip doesn't have enough pins to be square, pins will be added.
- Extra pins are either a ground or voltage supply pin.
- Half are ground, half are voltage supply.
- If there is an odd number of extra pins, the odd one out is ground
Your program will take input as a single integer, which is the minimum number of pins the manufacturing needs. You will then output 4 integers:
- The number of pins (total)
- The number of pins per side
- The number of ground pins added
- The number of voltage supply pins added
- You can use any language
- This is code-golf, to the shortest answer in bytes wins
- Bonus: -50 for printing an ASCII chip:
Something like this:
(For example with an input of 20)