Skip to content

Instantly share code, notes, and snippets.

View rabiulcste's full-sized avatar

Rabiul Awal rabiulcste

View GitHub Profile
int main()
{
int n, cnt = 0;
cin >> n;
while(n)
{
n &= (n-1);
cnt++;
}
cout << cnt <<endl;
void primeFactors(int n)
{
// Print the number of 2s that divide n
while (n%2 == 0)
{
printf("%d ", 2);
n = n/2;
}
// n must be odd at this point. So we can skip one element (Note i = i +2)
void multiply(char a[], char b[], char res[])
{
int i, j, k, mul, carry;
// if one number is zero, then result obviously zero
if(strcmp(a, "0") == 0 || strcmp(b, "0") == 0)
{
strcpy(res, "0");
return;
}
@rabiulcste
rabiulcste / Basic Template and Headers.cpp
Created January 7, 2016 15:37
Competitive Programming - Problem Solving Basic Codings
#include <bits//stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007