|
|
back to boardWA #2 I did it correct, Why Wrong Answer??? input: 2 2 10 Output: 2.00 1 1 Algo: cin>>a>>b; cin>>k; for(i=0; i<=k-1; i++){ for(j=0;j<=k-i; j++){ l=i*i+j*j; g=i*a+j*b; x=g-l; if(x>=r){n++; r=x; s[n]=r; si[n]=i; sj[n]=j;}}} for(int y=1; y<=n; y++){ if(s[n]==s[y]){ cout<<fixed<<setprecision(2)<<s[y]; cout<<endl<<si[y]<<" "<<sj[y]<<endl; } } Is it right? |
|
|