結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー yuji9511yuji9511
提出日時 2021-07-21 22:08:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 702 ms / 2,000 ms
コード長 1,742 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 207,796 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 05:18:23
合計ジャッジ時間 8,579 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 702 ms
6,816 KB
testcase_01 AC 139 ms
6,944 KB
testcase_02 AC 136 ms
6,940 KB
testcase_03 AC 136 ms
6,944 KB
testcase_04 AC 137 ms
6,940 KB
testcase_05 AC 137 ms
6,940 KB
testcase_06 AC 137 ms
6,940 KB
testcase_07 AC 142 ms
6,944 KB
testcase_08 AC 136 ms
6,940 KB
testcase_09 AC 140 ms
6,940 KB
testcase_10 AC 43 ms
6,940 KB
testcase_11 AC 50 ms
6,944 KB
testcase_12 AC 49 ms
6,944 KB
testcase_13 AC 49 ms
6,944 KB
testcase_14 AC 49 ms
6,940 KB
testcase_15 AC 49 ms
6,940 KB
testcase_16 AC 49 ms
6,940 KB
testcase_17 AC 49 ms
6,940 KB
testcase_18 AC 49 ms
6,940 KB
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
ostream& operator<<(ostream& os, lpair& h){ os << "(" << h.first << ", " << h.second << ")"; return os;}
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
vll factor(ll M){
    vll fac;
    if(M == 1){
        fac.push_back(1); return fac;
    }
    for(ll i = 2; i*i <= M; i++){
        while(M % i == 0){
            fac.push_back(i); M /= i;
        }
    }
    if(M != 1) fac.push_back(M);
    sort(fac.begin(), fac.end());
    return fac;
}


void solve3(){
    ll N;
    cin >> N;
    rep(i,2,1000){
        vll d = factor(i);
        map<ll,ll> mp;
        for(auto &e: d) mp[e]++;
        ll val1 = 1, val2 = 1;
        for(auto &e: mp){
            ll cnt = 0;
            ll v = N;
            while(v % e.first == 0){
                cnt++;
                v /= e.first;
            }
            val1 *= cnt + 1;
            val2 *= cnt + 1 + e.second;
        }
        if(val2 == val1 * 2){
            print(N*i);
            return;
        }
    }

}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) solve3();
}
0