Source Code
//============================================================================
// Name        : mmmmmmmm.cpp
// Author      : sameh mohamed
// Copyright   : don't try i'm warnning you......
// Description : Hello World
//============================================================================
//Egypt came then History
//Pharoas were coders but using different compilers{}{}{}{}{}}}}{{{{@#$%^^&&$$$###()()(***)))([][][][][]]][
#include<bits/stdc++.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
long long ss(long long n)
{
	long long c=0;
	while(n)
	{
		long long m=log2(n);
		n=n-exp2(m);
		c++;
	}
	return c;
}
int main()
{
int t;
cin>>t;
while(t--)
{
	long long n;
	cin>>n;
	long long a=0,b=0;
	while(true)
	{
		long long m=ss(n);
		a+=m;
		b+=m-1;
		if(m==1)
			break;
		else
			n=m;
	}
	cout<<b<<" / "<<a<<endl;
}
return 0;
}
Copy
The Complete tournament sameh58
GNU G++17
208 ms
1.2 MB
Wrong Answer