Created
March 9, 2015 17:08
-
-
Save ik11235/ced670ef8c84f07a96e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThePermutationGameDiv2 { | |
public: | |
long long int lcm(long long int a,long long int b) | |
{ | |
if (b==0 || a == 0 ) | |
return 0; | |
return ((a / gcd(a, b)) * b); | |
} | |
long long int gcd(long long int a,long long int b) | |
{ | |
return b==0?a:gcd(b, a%b); | |
} | |
long long findMin(int N) { | |
long long ans=1; | |
for(int i=2;i<=N;i++) | |
{ | |
ans=lcm(ans,i); | |
} | |
return ans; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment