結果
| 問題 | No.1611 Minimum Multiple with Double Divisors | 
| コンテスト | |
| ユーザー |  umezo | 
| 提出日時 | 2021-07-21 23:50:44 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 686 bytes | 
| コンパイル時間 | 1,809 ms | 
| コンパイル使用メモリ | 199,176 KB | 
| 最終ジャッジ日時 | 2025-01-23 05:20:46 | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 28 TLE * 9 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:43:13: warning: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   43 |     cout<<c*x<<endl;
      |             ^
main.cpp:36:8: note: ‘c’ was declared here
   36 |     ll c;
      |        ^
            
            ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int prime_factor(ll x){
  map<ll,int> res;
  
  for(ll i=2;i*i<=x;i++){
    while(x%i==0){
      res[i]++;
      x/=i;
    }
  }
  if(x!=1) res[x]++;
  
  int ans=1;
  for(auto t:res) ans*=t.second+1;
  
  return ans;
}
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int t;
  cin>>t;
  while(t--){
    ll x;
    cin>>x;
    int tmp=prime_factor(x);
    
    ll c;
    for(int i=2;i<=31;i++){
      if(prime_factor(i*x)==2*tmp){
        c=i;
        break;
      }
    }
    cout<<c*x<<endl;
  }
  
  return 0;
}
            
            
            
        