結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー SSRS
提出日時 2021-07-21 21:31:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,538 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 1,648 ms
コンパイル使用メモリ 166,200 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-03 02:21:20
合計ジャッジ時間 12,203 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int T;
  cin >> T;
  for (int i = 0; i < T; i++){
    long long X;
    cin >> X;
    long long Y = X * 2;
    while (true){
      int cx = 1, cy = 1;
      int p = 2;
      long long X2 = X, Y2 = Y;
      while (X2 != Y2){
        int cntx = 0;
        while (X2 % p == 0){
          X2 /= p;
          cntx++;
        }
        int cnty = 0;
        while (Y2 % p == 0){
          Y2 /= p;
          cnty++;
        }
        cx *= cntx + 1;
        cy *= cnty + 1;
        p++;
      }
      if (cy == cx * 2){
        cout << Y << endl;
        break;
      } else {
        Y += X;
      }
    }
  }
}
0