Skip to content

Instantly share code, notes, and snippets.

@ArthurLoboLobo
Created August 17, 2023 18:19
Show Gist options
  • Save ArthurLoboLobo/9884a36c79ce6a35fe8dd8fc56eaed8c to your computer and use it in GitHub Desktop.
Save ArthurLoboLobo/9884a36c79ce6a35fe8dd8fc56eaed8c to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int d,g;
cin >> d >> g;
int ans = 0;
for(int x = -100; x <= 100; x++) {
int dl = d+x;
int gl = g-4*x;
ans = max(ans,min(dl/6,gl));
}
cout << ans << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment