SPOJ - Girls And Boys Problem Solution
Solution:-
using namespace std;
int main()
{
int g,b;
while(1)
{
cin>>g>>b;
if(g==-1 && b==-1)
break;
else if(g==0 && b==0)
cout<<g;
else if(g>b)
cout<<ceil(double(g)/(b+1));
else
cout<<ceil(double(b)/(g+1));
cout<<endl;
}
}
No comments:
Post a Comment