ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1619. Big Brother

What's my solution problem?
Posted by SabaRG 17 Aug 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?
Posted by kai_99 17 Aug 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