結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー auauaauaua
提出日時 2021-07-21 22:29:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 1,624 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 166,228 KB
実行使用メモリ 11,836 KB
最終ジャッジ日時 2024-04-14 05:22:43
合計ジャッジ時間 9,937 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 591 ms
11,660 KB
testcase_01 AC 256 ms
11,632 KB
testcase_02 AC 258 ms
11,648 KB
testcase_03 AC 265 ms
11,712 KB
testcase_04 AC 264 ms
11,700 KB
testcase_05 AC 263 ms
11,704 KB
testcase_06 AC 265 ms
11,652 KB
testcase_07 AC 259 ms
11,712 KB
testcase_08 AC 262 ms
11,836 KB
testcase_09 AC 265 ms
11,668 KB
testcase_10 AC 192 ms
11,692 KB
testcase_11 AC 211 ms
11,628 KB
testcase_12 AC 209 ms
11,628 KB
testcase_13 AC 214 ms
11,696 KB
testcase_14 AC 212 ms
11,656 KB
testcase_15 AC 215 ms
11,660 KB
testcase_16 AC 214 ms
11,636 KB
testcase_17 AC 213 ms
11,640 KB
testcase_18 AC 213 ms
11,808 KB
testcase_19 AC 18 ms
11,732 KB
testcase_20 AC 19 ms
11,664 KB
testcase_21 AC 18 ms
11,728 KB
testcase_22 AC 20 ms
11,652 KB
testcase_23 AC 19 ms
11,648 KB
testcase_24 AC 18 ms
11,692 KB
testcase_25 AC 18 ms
11,708 KB
testcase_26 AC 18 ms
11,716 KB
testcase_27 AC 18 ms
11,636 KB
testcase_28 AC 15 ms
11,724 KB
testcase_29 AC 16 ms
11,712 KB
testcase_30 AC 16 ms
11,656 KB
testcase_31 AC 17 ms
11,688 KB
testcase_32 AC 16 ms
11,776 KB
testcase_33 AC 16 ms
11,748 KB
testcase_34 AC 16 ms
11,660 KB
testcase_35 AC 17 ms
11,700 KB
testcase_36 AC 15 ms
11,628 KB
testcase_37 AC 16 ms
11,696 KB
testcase_38 AC 16 ms
11,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
//#define vec vector<ll>
//#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=998244353;
const ll inf=INF*INF;
const ll mod=INF;
const ll MAX=1000010;
const double PI=acos(-1.0);
typedef vector<vector<ll> > mat;
typedef vector<ll> vec;





signed main(){
    ll t;
    cin>>t;
    vector<ll>p(MAX);
    vector<ll>a(0);
    REP(i,2,MAX/2){
        ll k=1;
        if(p[i]>0)continue;
        a.pb(i);
        while(k*i<MAX){
            if(p[k*i]==0)p[k*i]=i;
            k++;
        }
    }

    while(t--){
        ll x;cin>>x;
        REP(i,2,100){
            ll z=i;
            ll y=x;
            ll cn=1;
            ll cnt=1;
            while(z>1){
                ll b=p[z];
                ll s=1;
                while(z%b==0){
                    s++;
                    z/=b;
                }
                ll ss=1;
                while(y%b==0){
                    ss++;
                    s++;
                    y/=b;
                }
                cnt*=ss;
                cn*=s;
            }
            if(cnt*2==cn){
                cout<<x*i<<endl;
                break;
            }
        }
    }
}
0