結果
| 問題 |
No.1611 Minimum Multiple with Double Divisors
|
| コンテスト | |
| ユーザー |
kazu0x17
|
| 提出日時 | 2021-07-21 23:58:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 975 bytes |
| コンパイル時間 | 719 ms |
| コンパイル使用メモリ | 80,996 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-17 20:47:58 |
| 合計ジャッジ時間 | 6,766 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 28 |
ソースコード
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
using lli = long long int;
using pii = std::pair<lli, lli>;
int main(){
lli t;
cin >> t;
for(int i = 0; i < t; i++) {
lli x;
cin >> x;
// cout << x << endl;;
bool flag = false;
lli cnt = 0;
lli ans = 1e9;
for(lli j = 2; j <= 35 and not flag; j++) {
if(x%j != 0){
ans = min(ans, j);
flag = true;
}
cnt = j+1;
}
if(not flag)ans = min(ans, cnt);
vector<lli> c(3, 0), d(3);
d[0] = 2, d[1] = 3, d[2] = 5;
for(int j = 0; j < c.size(); j++) {
lli tmp = x;
while(tmp%d[j] == 0){
tmp /= d[j];
c[j]++;
}
if(c[j] > 0) ans = min(ans, (lli)pow(d[j], (c[j]+1)));
}
cout << ans*x << endl;
}
}
kazu0x17