結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー jutamajutama
提出日時 2021-07-21 22:00:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 4,518 bytes
コンパイル時間 4,470 ms
コンパイル使用メモリ 184,300 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-24 17:32:35
合計ジャッジ時間 35,665 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 958 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 646 ms
4,376 KB
testcase_29 AC 643 ms
4,376 KB
testcase_30 AC 644 ms
4,376 KB
testcase_31 AC 648 ms
4,380 KB
testcase_32 AC 644 ms
4,380 KB
testcase_33 AC 646 ms
4,376 KB
testcase_34 AC 644 ms
4,376 KB
testcase_35 WA -
testcase_36 AC 648 ms
4,376 KB
testcase_37 AC 649 ms
4,376 KB
testcase_38 AC 646 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bitset>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using namespace atcoder;

typedef long long ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<int, ll> pil;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, ld> pid;
typedef std::pair<int, std::string> pis;
typedef std::pair<ll, std::string> pls;
typedef std::vector<bool> vb;
typedef std::vector<vb> vvb;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::vector<vvi> vvvi;
typedef std::vector<vvvi> vvvvi;
typedef std::vector<ll> vl;
typedef std::vector<vl> vvl;
typedef std::vector<vvl> vvvl;
typedef std::vector<vvvl> vvvvl;
typedef std::vector<ld> vd;
typedef std::vector<vd> vvd;
typedef std::vector<std::string> vs;
#define rep(i,n) for(auto i=0; i<n; ++i)
#define repm(i,s,n) for(auto i=s; i<n; ++i)
#define repd(i,n) for(auto i=n-1; i>=0; --i)
#define repdm(i,e,n) for(auto i=n-1; i>=e; --i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

template <class T> inline bool chmax(T& a, T b, int eq = 0) { if (a < b || (a == b && eq)) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b, int eq = 0) { if (a > b || (a == b && eq)) { a = b; return 1; } return 0; }

template <class mint, internal::is_modint_t<mint>* = nullptr> constexpr istream& operator>>(istream& is, mint& x) noexcept {long long v = 0; std::cin >> v; x = v; return is;}
template <class mint, internal::is_modint_t<mint>* = nullptr> constexpr ostream& operator<<(ostream& os, const mint& x) noexcept {os << x.val(); return os;}
inline void _n() { std::cout << std::endl; }
template <class T> inline void _(const T a) { std::cout << a; }
template <class T> inline void _l(const T a) { _(a); _n(); }
template <class T> inline void _s(const T a) { _(a); _(' '); }
template <class T> inline void _v(const std::vector<T> v) { for(auto a : v) _(a); }
template <class T> inline void _vl(const std::vector<T> v) { for(auto a : v) _l(a); }
template <class T> inline void _vs(const std::vector<T> v) { for(auto a : v) _s(a); _n(); }
template <class T> inline void _vvl(const std::vector<std::vector<T>> v) { for(auto a : v) { _v(a); _n(); } }
template <class T> inline void _vvs(const std::vector<std::vector<T>> v) { for(auto a : v) { _vs(a); } }
inline void ynl(const bool b) {_l(b ? "yes" : "no");}
inline void yns(const bool b) {_l(b ? "Yes" : "No");}
inline void ynu(const bool b) {_l(b ? "YES" : "NO");}

constexpr int INF = numeric_limits<int>::max() >> 1;
constexpr long long INF_LL = numeric_limits<long long>::max() >> 1LL;
constexpr long long MOD1 = 1000000007;
constexpr long long MOD9 = 998244353;
using mint1 = atcoder::modint1000000007;
using mint9 = atcoder::modint998244353;

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

bool is_prime (long long n) {
    assert(1 <= n);
    if(n == 1) return false;
    for (unsigned long long i = 2; i * i <= (unsigned long long)n; i++) {
        if(n % i == 0) return false;
    }
    return true;
}

void solve() {
    
 
    vl P;
    repm(p, 2ll, 1000000ll) {
        if(is_prime(p)) P.push_back(p);
    }
    
    int T; cin >> T;
    while(T--) {
        ll X; cin >> X;
        ll Xc = X;
        vl M;
        for(ll p : P) {
            ll cnt = 0;
            while(Xc % p == 0) {
                cnt++;
                Xc /= p;
            }
            M.push_back(powl(p, cnt+1));
            if(cnt == 0) break;
        }
        if(Xc > 1) M.push_back(powl(Xc, 1));
        sort(all(M));

        ll ans = X * M[0];
        _l(ans);
    }

    
    
  //    int N, M; cin >> N >> M;
  //    vvi E(N, vi());
  //    rep(i, M) {
  //        int A, B; cin >> A >> B;
  //        A--; B--;
  //        E[A].push_back(B);
  //        E[B].push_back(A);
  //    }
  //
  //    int cnt = 0;
  //    vi used(N);
  //    rep(i, N) {
  //        if(used[i]) continue;
  //
  //    }
      
    
    
    
    
}

//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *//

int main() {
    
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    std::cin.tie(0);
    std::cout.tie(0);
    std::ios::sync_with_stdio(false);
    
    solve();
    
    return 0;
}
0