|
|
back to boardWHY TLE ON TEST #9 MY COD IS SIMPLE #include<iostream> #include<math.h> using namespace std; int main() { long long n,p,a=1; cin>>n; while(1) { p=(1-2*a+sqrt((2*a-1)*(2*a-1)+8*n))/2; if(2*n==2*p*a+p*(p-1)) { cout<<a<<" "<<p; break; } a++; } return 0; } Re: WHY TLE ON TEST #9 MY COD IS SIMPLE Posted by ELDVN 14 Nov 2015 14:28 On test #9 my solution got the same problem. Edited by author 14.11.2015 14:30 |
|
|