Created
September 15, 2018 10:33
-
-
Save completejavascript/d77cb947b1267bc15b51707e1b3f3f02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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