Marbles problem

Whats wrong with this code
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
long long n,k, prod1 = 1, prod2 = 1;
cin>>n>>k;
n = n-1;
k = k-1;
k = min(k, n-k);
long long temp = n;

	for(int i = 1 ; i<=k; i++){
		prod1 *= temp;
		prod2 *= i;
		temp--;
	}
	cout<<(prod1/prod2)<<endl;

}

return 0;

}

Hey your variables ill overflow, its clearly mentioned that “You can assume that this number exceeds the limit of a signed 64-bit integer.”
Use this instead :https://ide.codingblocks.com/s/323955
:slight_smile:
Also from next time please give your code in Coding blocks IDE.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.