結果
| 問題 | No.1611 Minimum Multiple with Double Divisors | 
| コンテスト | |
| ユーザー |  kiyoshi0205 | 
| 提出日時 | 2021-07-21 22:03:22 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 854 bytes | 
| コンパイル時間 | 3,735 ms | 
| コンパイル使用メモリ | 229,476 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-17 18:30:50 | 
| 合計ジャッジ時間 | 11,470 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 2 | 
| other | RE * 37 | 
コンパイルメッセージ
main.cpp: In function 'int sol(ll)':
main.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
#define rep(i,N) for(int i=0;i<N;++i)
using ll=long long;
constexpr int ch[]={2,3,5,7,11,13,17,19,23,29,31,37};
vector<int> vch[40];
int sol(ll N){
  vector<int> cnt(12,0);
  rep(i,12)while(N%ch[i]==0){
    N/=ch[i];
    cnt[i]++;
  }
  ll now=1;
  for(auto x:cnt)now*=x+1;
  rep(ans,40){
    auto& t=vch[ans];
    ll ret=now;
    rep(i,12){
      if(t[i]){
        ret/=cnt[i]+1;
        ret*=cnt[i]+t[i]+1;
      }
    }
    if(ret==now*2)return ans+1;
  }
}
int main(){
  rep(j,40){
    if(j==0)continue;
    vector<int> v(12,0);
    auto N=j+1;
    rep(i,12)while(N%ch[i]==0){
      N/=ch[i];
      v[i]++;
    }
    vch[j]=v;
  }
  cin.tie(0);
  ios::sync_with_stdio(0);
  int T;
  cin>>T;
  while(T--){
    ll N;
    cin>>N;
    cout<<sol(N)*N<<'\n';
  }
}
            
            
            
        