|
|
вернуться в форумWhat's my solution problem? Послано SabaRG 17 авг 2008 15:07 #include <iostream> using namespace std; int main() { int n,k,m; cin>>n; while(n) { cin>>k>>m; if(!k && !m) cout<<"1\n"; else if(k<m) cout<<"0\n"; else cout<<(float)k/(k+m)<<endl; n--; } return 0; } Edited by author 17.08.2008 15:09 Re: What's my solution problem? Послано kai_99 17 авг 2008 16:29 I have the same problem #include <iostream> using namespace std; struct money { double alex,bob;}; money a[2005]; int n; void solve (int p) { float q; if (a[p].alex==a[p].bob) q=1/(1+a[p].alex); // else if (a[p].bob>a[p].alex) q=0; else q=a[p].alex/(a[p].bob+a[p].alex); cout<<q<<endl;} int main () { cin>>n; for (int i=0;i<n;i++) cin>>a[i].alex>>a[i].bob; for (int i=0;i<n;i++) solve (i); return 0; } Where am I wrong? Edited by author 17.08.2008 16:54 |
|
|