views:

97

answers:

0

What would be the best solution for this problem??

if we have a question say by the pythagoran theorem.

x^2+ y^2 = c

then according to that if we are given the value of c, what shall be the best way to deal and find the values of x and y? x and y can be negative. Also, suppose c=0 then x=0 and y=0. Moreover, if we have c=1 then we have the following tuples: (0,1) , (1,0) , (-1,0), (0,-1).

Thus given any number, we have to get the value of count of how many tuples this law applies to.

so if we have a function int getTupleCount ( int n)

we have to get the count of all the tuples which can satisfy the condition. x^2+y^2=c

Please help me on this..Thanks!