procon

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub mugen1337/procon

:heavy_check_mark: Math/Factorize.hpp

Verified with

Code

template<typename INT>
vector<INT> Factorize(INT x){
    vector<INT> ret;
    for(INT i=2;i*i<=x;i++){
        while(x%i==0){
            ret.push_back(i);
            x/=i;
        }
    }
    if(x!=1) ret.push_back(x);
    sort(begin(ret),end(ret));
    return ret;
}
#line 1 "Math/Factorize.hpp"
template<typename INT>
vector<INT> Factorize(INT x){
    vector<INT> ret;
    for(INT i=2;i*i<=x;i++){
        while(x%i==0){
            ret.push_back(i);
            x/=i;
        }
    }
    if(x!=1) ret.push_back(x);
    sort(begin(ret),end(ret));
    return ret;
}
Back to top page