Created
December 28, 2014 13:45
-
-
Save ik11235/a42d9604fac2ff01d3ec 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 TheKingsFactorization { | |
public: | |
vector<long long> getVector(long long N, vector<long long> primes) { | |
for (int i=0; i<primes.size() ;i++) { | |
N/=primes[i]; | |
} | |
for (int n=2; n<1000000&&N>1; n++) { | |
if(N%n==0) | |
{ | |
primes.push_back(n); | |
N/=n; | |
n--; | |
} | |
} | |
if(N>1) | |
primes.push_back(N); | |
sort(primes.begin(),primes.end()); | |
return primes; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment