Skip to content

Instantly share code, notes, and snippets.

@completejavascript
Created September 15, 2018 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save completejavascript/d77cb947b1267bc15b51707e1b3f3f02 to your computer and use it in GitHub Desktop.
Save completejavascript/d77cb947b1267bc15b51707e1b3f3f02 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
int main()
{
// freopen("input.txt","r",stdin);
int G, B;
while(true)
{
cin >> G >> B;
if(G == -1 && B == -1) break;
int min = ((G < B) ? G : B);
int max = (G + B) - min;
int tmp = max % (min+1);
if(tmp == 0) cout << max / (min+1) << endl;
else cout << (max / (min+1)) + 1 << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment