結果
| 問題 |
No.1611 Minimum Multiple with Double Divisors
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-08-09 17:17:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 948 bytes |
| コンパイル時間 | 1,092 ms |
| コンパイル使用メモリ | 96,360 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-09 17:17:59 |
| 合計ジャッジ時間 | 7,817 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 28 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t;
cin>>t;
const int mx = 3e5;
vector<int> cnt(mx+1,0);
vector<int> use;
for(int i = 2;i<=mx;i++){
if(cnt[i]) continue;
use.push_back(i);
for(int j = i;j<=mx;j+=i) cnt[j] = 1;
}
while(t--){
ll a;
cin>>a;
ll ans = a * 100;
for(auto&e:use){
if(a*e>ans) break;
int cnt = 0;
ll b = a;
while(b%e==0){
b /= e;
cnt++;
}
int m = cnt + 1;
int want = 2 * m - 1;
ll now = a;
for(int i = 0;i<want-cnt;i++) {
now *= e;
if(now>ans) break;
}
ans = min(ans,now);
}
cout<<ans<<endl;
}
}
momoyuu