秋祭 | 静岡高校工学部



卬高杯


提出詳細

提出id提出時刻ユーザー名問題言語判定状況判定実行時間
1150022023-10-25 09:43:47aradEcpp54/54AC7

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using P = pair<ll,ll>;
using VP = vector<P>;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define out(x) cout << x << endl
#define dout(x) cout << fixed << setprecision(10) << x << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)(x.size())
#define re0 return 0
#define pcnt __builtin_popcountll
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
constexpr int inf = 1e9;
constexpr ll INF = 1e18;
//using mint = modint1000000007;
//using mint = modint998244353;
int di[4] = {1,0,-1,0};
int dj[4] = {0,1,0,-1};

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        res.push_back({a, ex});
    }

    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    ll n;
    cin >> n;
    VL ans;
    while(n%57==0){
        ans.emplace_back(57);
        n /= 57;
    }
    VP pr = prime_factorize(n);
    for(auto c:pr){
        rep(_,c.second) ans.emplace_back(c.first);
    }
    sort(all(ans));
    rep(i,sz(ans)){
        cout << ans[i];
        if(i == sz(ans)-1) cout << endl;
        else cout << ' ';
    }
}

sample1.txt AC 2
sample2.txt AC 2
sample3.txt AC 3
sample4.txt AC 7
case1.txt AC 6
case2.txt AC 7
case3.txt AC 7
case4.txt AC 6
case5.txt AC 6
case6.txt AC 7
case7.txt AC 7
case8.txt AC 7
case9.txt AC 6
case10.txt AC 6
case11.txt AC 6
case12.txt AC 6
case13.txt AC 6
case14.txt AC 6
case15.txt AC 6
case16.txt AC 6
case17.txt AC 6
case18.txt AC 6
case19.txt AC 6
case20.txt AC 6
case21.txt AC 6
case22.txt AC 6
case23.txt AC 6
case24.txt AC 6
case25.txt AC 6
case26.txt AC 6
case27.txt AC 6
case28.txt AC 6
case29.txt AC 7
case30.txt AC 7
case31.txt AC 6
case32.txt AC 6
case33.txt AC 6
case34.txt AC 6
case35.txt AC 6
case36.txt AC 6
case37.txt AC 6
case38.txt AC 6
case39.txt AC 6
case40.txt AC 6
case41.txt AC 6
case42.txt AC 6
case43.txt AC 7
case44.txt AC 6
case45.txt AC 7
case46.txt AC 7
case47.txt AC 7
case48.txt AC 7
case49.txt AC 7
case50.txt AC 7
7 AC7 AC