fake_Bezawada Posted March 30, 2016 Report Posted March 30, 2016 Ozo is making a project on mathematical equation given by his teacher, but he want to test the given equation, whether this equation contain any positive integral root or not. Because if equation does not contain integral root his project will give abnormal results and he will not able to submit his project on time.Equation: x^2 = N - Bx where N is an integer, B is sum of digits of number x. Your task is to find smallest positive integral root of this equation. INPUT First line of Input contains no. of test cases T. Each test case contain "N". OUTPUT For each test case output smallest positive integral root of the equation or print -1 if there is no positive integral roots. CONSTRAINTS T<=10^5 1<=N<=8 * 10^18
fake_Bezawada Posted March 30, 2016 Author Report Posted March 30, 2016 SAMPLE INPUT 2 2 4 SAMPLE OUTPUT 1 -1
fake_Bezawada Posted March 30, 2016 Author Report Posted March 30, 2016 chusthe easy laage vundhi kani naku em ardakatla evaraina easy ga simplified ga explain cheyyara please
GunturGongura Posted March 30, 2016 Report Posted March 30, 2016 Idi quadratic equation kada man..smallest integral root anta….so equation has to become zero
GunturGongura Posted March 30, 2016 Report Posted March 30, 2016 input 2-x 2-B 8-N 2 is a smallest integral root
fake_Bezawada Posted March 30, 2016 Author Report Posted March 30, 2016 input 2-x 2-B 8-N 2 is a smallest integral rootkadu akka for input 2 output 1 vundi choodu
aakathaai Posted March 30, 2016 Report Posted March 30, 2016 itta mosam chesthe chepdamanukunnodiki kooda g lo current pass ai cheppadu
siru Posted March 30, 2016 Report Posted March 30, 2016 input 2-x 2-B 8-N 2 is a smallest integral root Gongura pachadi lo leg vesav :(
fake_Bezawada Posted March 30, 2016 Author Report Posted March 30, 2016 itta mosam chesthe chepdamanukunnodiki kooda g lo current pass ai cheppadunormal ga vunchite evadu cheppaledu
GunturGongura Posted March 30, 2016 Report Posted March 30, 2016 kadu akka for input 2 output 1 vundi choodu Equation: x^2 = N - Bx where N is an integer, B is sum of digits of number x. Your task is to find smallest positive integral root of this equation.INPUTFirst line of Input contains no. of test cases T. Each test case contain "N".OUTPUTFor each test case output smallest positive integral root of the equation or print -1 if there is no positive integral roots.CONSTRAINTST<=10^51<=N<=8 * 10^18 each test case contain N ..let N be 8 , if x is 2 then B is 2 …task anti to find smallest positive integral root--- x^2+Bx-N =0 , substitute all those values so 0 avtundi ….it means x=2 is the smallest positive integral root so output will be 2,if it is positive integral root or else -1 if there is no positive integral roots.
GunturGongura Posted March 30, 2016 Report Posted March 30, 2016 Gongura pachadi lo leg vesav :( kadu..its correct
irukupaalem Posted March 30, 2016 Report Posted March 30, 2016 normal ga vunchite evadu cheppaleduvaste cheptadu..nuvvu ammai kathila undi ante rakundane chepestada?..lol seap tricks
GunturGongura Posted March 30, 2016 Report Posted March 30, 2016 kadu akka for input 2 output 1 vundi choodu arey question lo em undi ra.. means x=2 is the smallest positive integral root so output will be 2,if it is positive integral root or else -1 if there is no positive integral roots. output should be 2 for input 2 if its not a root then output should be -1
Recommended Posts