Skip to content

Commit

Permalink
Merge pull request #524 from hg398/master
Browse files Browse the repository at this point in the history
Issue #457
  • Loading branch information
Srikant Singh authored Oct 27, 2018
2 parents 1571300 + a0a7803 commit 30c9501
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Algorithms/STL binary representation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

// BY hg398

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

int main() {
boost;
int num;
cin>>num; //input number
bitset <64> bit_rep=num; //bitset to convert number into binary representation
for(int i=63;i>=0;i--)cout<<bit_rep[i]; //printing binary representation
return 0;
}
24 changes: 24 additions & 0 deletions Tricky Problems/max_of_two_numbers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

// BY hg398

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

int largest(int a,int b)
{
return a*(bool)(a/b) + b*(bool)(b/a);
}

int main() {
boost;
int num1,num2;
cin>>num1>>num2;
if(num1==num2)
cout<<num1;
else
cout<<largest(num1,num2);
return 0;
}

0 comments on commit 30c9501

Please sign in to comment.