|
|
back to boardWA9 ! what's wrong with my code !?! my code here #include<iostream> #include<math.h> using namespace std; int main() { int n; int p; double a; int i; cin>>n; int flag; for(p=sqrt(n*2);p>0;p--) { a=(double)n/p-(double)(p-1)/2; if(a==(int)a && a>0) { cout<<a<<" "<<p; return 0; }
} cout<<n<<" "<<1; return 0; } Re: WA9 ! what's wrong with my code !?! my code here Edited by author 09.10.2008 14:39 Re: WA9 ! what's wrong with my code !?! my code here cout << (int)a << " " << p; :) |
|
|