|
|
back to boardWhi time limit. help #include <fstream.h> #include <math.h>
int main() { // p*(2*a+p-1) = 2*n ==> long n; cin>>n; n*=2; for(long p=sqrt(n); p>1; p==1) if(n%p==0) if(n/p>p && (n/p-p)%2) {cout<<(n/p-p+1)/2<<' '<<p<<endl; return 0;} return 0; } int`s wa code Posted by Oleg 6 Dec 2002 06:28 #include <fstream.h> #include <math.h> int main() { long n; cin>>n; n; long p; for(p=n; p>1; p--) if (((2*n-p*(p-1))%(2*p))==0) if ((int((2*n-p*(p-1))/(2*p)))>0) {cout<<int((2*n-p*(p-1))/(2*p))<<' '<<p<<endl; return 0;} return 0; } |
|
|