GIRLSNBS - Girls and Boys
#include <iostream>
using namespace std;
int main()
{
int g, b, result;
while(true)
{
cin >> g >> b;
if(g == -1 && b == -1)
break;
if(g < b)
{
int temp = g;
g = b;
b = temp;
}
if(g == 0 && b == 0)
{
cout << "0\n";
continue;
}
if(b == 0)
{
cout << g << "\n";
continue;
}
if(g == b)
{
cout << "1\n";
continue;
}
b = b + 1;
result = g / (b);
if(g % b != 0)
result++;
cout << result << "\n";
}
return 0;
}
Comments
Post a Comment