// http://www.spoj.com/problems/GIRLSNBS/
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int g, b;
cin >> g >> b;
while (g != -1 && b != -1) {
int bigger, smaller;
if (g > b) {
bigger = g;
smaller = b + 1;
}
else {
bigger = b;
smaller = g + 1;
}
if (bigger == 0 && smaller == 0) {
cout << 0 << endl;
}
else {
double result = (double)bigger / (double)smaller;
cout << (int)ceil(result) << endl;
}
cin >> g >> b;
}
return 0;
}
SPOJ GIRLSNBS
最新推荐文章于 2022-08-23 16:32:57 发布