結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー kiyoshi0205kiyoshi0205
提出日時 2021-07-21 22:11:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 849 bytes
コンパイル時間 4,140 ms
コンパイル使用メモリ 224,460 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 05:19:50
合計ジャッジ時間 8,561 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
6,816 KB
testcase_01 AC 82 ms
6,944 KB
testcase_02 AC 82 ms
6,944 KB
testcase_03 AC 80 ms
6,944 KB
testcase_04 AC 81 ms
6,940 KB
testcase_05 AC 81 ms
6,940 KB
testcase_06 AC 79 ms
6,944 KB
testcase_07 AC 80 ms
6,944 KB
testcase_08 AC 81 ms
6,944 KB
testcase_09 AC 81 ms
6,944 KB
testcase_10 AC 48 ms
6,940 KB
testcase_11 AC 55 ms
6,940 KB
testcase_12 AC 55 ms
6,940 KB
testcase_13 AC 54 ms
6,940 KB
testcase_14 AC 55 ms
6,940 KB
testcase_15 AC 55 ms
6,940 KB
testcase_16 AC 55 ms
6,940 KB
testcase_17 AC 55 ms
6,940 KB
testcase_18 AC 56 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,948 KB
testcase_32 AC 1 ms
6,940 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  }
  assert(false);
}
int main(){
  rep(j,40){
    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';
  }
}
0