結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー nawawan
提出日時 2021-07-21 21:40:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 954 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 167,436 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-17 16:59:38
合計ジャッジ時間 10,956 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int testcase;
    cin >> testcase;
    vector<int> prime(100, -1);
    for(int i = 2; i < 100; i++){
        int t = i;
        prime[i] = i;
        while(t + i < 100){
            t += i;
            prime[t] = i;
        }
    }
    while(testcase--){
        long long X;
        cin >> X;
        if(X == 1){
            cout << 2 << endl;
            continue;
        }
        long long temp = 1000000000000000000;
        for(long long i = 0; i < 100; i++){
            if(prime[i] == i && X % i != 0){
                temp = min(temp, i);
            }
            if(prime[i] == i && X % i == 0){
                long long t = X;
                long long po = 1;
                while(t % i == 0){
                    po *= i;
                    t /= i;
                }
                temp = min(temp, po * i);
            }
        }
        cout << X * temp << endl;
    }
}
0