Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

The Wonder Equation 2

By Raihanur_R · Limits 1s, 512 MB

Today we will tell you the story of a Prince, Charles, Prince of the Herroku island. He was trained to be an unconquerable warrior. When Charles was a child his mother Queen Victoria always told him the story of a God. Actually, an evil god named Mazdean known as the god of war and destruction. One day Charles heard from a spy of his island that there is a war going on in a country called Atlanta and Mazdean the god of WAR is the reason for that war. After hearing this, Charles decided to go to Atlanta and kill Mazdean. Being true to his thoughts he arms himself with the “Legbiter” sword and leaves the island and reaches the place where war is happening. Charles was shocked when he went to Atlanta. Because of people In there, they are not normal!. Whatever you ask them, They will not answer your question at first, rather they will give you a Math equation to solve, and then they may answer your question. Strange people !!
When did Charles ask them “where is Mazdean?” People there give him this equation A2 + B2+ C2 + 2×A×B + 2×B×C + 2×C×A = N to solve and also they will give the value of N. Now, you have to find the number of combinations of (A, B, C) Triplet. Since Charles is a Herrokuan warrior, he is good at Combat field but not good at math. That’s why Charles is asking for your help. After all, you are a world-famous mathematician, who also knows coding. Now Help Charles to solve this equation so that he can find Mazdean and be able to kill him.


Input begins with an integer T(0 < T ≤ 103) for the number of cases to follow. Next T lines each contain a single integer N (0 < N ≤ 1018).


Print the Number of Combination of (A, B, C) Triplet and here A, B, C >= 1.





    90% Solution Ratio

    mijanurEarliest, 1M ago

    shefinFastest, 0.0s

    mijanurLightest, 131 kB

    steinumShortest, 118B


    Login to submit

    Related Contests