結果
問題 | No.1611 Minimum Multiple with Double Divisors |
ユーザー | monnu |
提出日時 | 2021-07-21 22:00:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,095 bytes |
コンパイル時間 | 3,835 ms |
コンパイル使用メモリ | 229,540 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 02:28:11 |
合計ジャッジ時間 | 20,446 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 TLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll=long long; using Graph=vector<vector<int>>; #define MAX 100 #define MOD 1000000007 #define INF 1000000000000000000 vector<int> p; vector<bool> p_table(MAX+1,true); void prime(){ p_table.at(0)=false,p_table.at(1)=false; for(int i=2;i<=MAX;i++){ if(p_table.at(i)){ p.push_back(i); for(int j=2;i*j<=MAX;j++){ p_table.at(i*j)=false; } } } } int main(){ prime(); int T; cin>>T; int n=p.size(); for(int i=0;i<T;i++){ ll X; cin>>X; for(ll num=2;;num++){ vector<int> cnt1(n,0),cnt2(n,1); ll tmp=num; ll x=X; for(int j=0;j<n;j++){ while(tmp%p[j]==0){ tmp/=p[j]; cnt1[j]++; } while(x%p[j]==0){ x/=p[j]; cnt2[j]++; } } int bunsi=1; int bunbo=1; for(int j=0;j<n;j++){ bunsi*=cnt1[j]+cnt2[j]; bunbo*=cnt2[j]; } if(bunsi==2*bunbo){ cout<<num*X<<endl; break; } } } }