Problem — Shovels and Swords | plz help i tried to find bug all night still did'nt get and i am frustrated!!!

Revision en1, by ABhinav2003, 2020-06-12 08:23:44
#include<bits/stdc++.h>
using namespace std;

long long int emerald(long long int sticks ,long long int diamonds)
{
	
	if(sticks <= 0 || diamonds <= 0 ||(sticks == 1 && diamonds == 1) )
	return 0;

	else
	return max(1+emerald(sticks - 1 , diamonds-2), 1+emerald(sticks-2,diamonds-1));
}


int main()
{
	
	int t;
	cin>>t;
	while(t--)
	{
		long long int sticks , diamonds;
		cin>>sticks>>diamonds;
		
		cout<<emerald(sticks,diamonds)<<"\n";
		
	}
}

-----------------------------------------------------------------------

HERE IS THE QUESTION — (https://codeforces.com/contest/1366/problem/A) |

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ABhinav2003 2020-06-12 08:23:44 827 Initial revision (published)