結果
問題 |
No.1611 Minimum Multiple with Double Divisors
|
ユーザー |
![]() |
提出日時 | 2021-07-22 00:38:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,275 bytes |
コンパイル時間 | 776 ms |
コンパイル使用メモリ | 77,920 KB |
実行使用メモリ | 17,216 KB |
最終ジャッジ日時 | 2024-07-17 21:00:28 |
合計ジャッジ時間 | 7,691 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | TLE * 1 -- * 36 |
ソースコード
#include<iostream> #include<vector> #include<cmath> #include<algorithm> using namespace std; using lli = long long int; int main(){ lli t; cin >> t; for(int i = 0; i < t; i++) { lli x; cin >> x; lli cnt = 0; lli ans = 1e9; for(lli j = 2; j <= 35; j++) { if(x%j != 0){ ans = min(ans, j); } } vector<lli> c(11, 0), d = {2,3,5,7,11,13,17,19,23,29,31}; for(int j = 0; j < c.size(); j++) { lli tmp = x; while(tmp%d[j] == 0){ tmp /= d[j]; c[j]++; } } for(int j = 2; j < 32; j++) { vector<lli> e(11, 0); for(int k = 0; k < c.size(); k++) { lli tmp = x, c = d[k]; while(tmp%d[k] == 0){ tmp /= d[k]; e[k]++; } } lli a = 1, b = 1; for(int k = 0; k < c.size(); k++) { a *= pow(d[k], c[k]); b *= pow(d[k], e[k]); } // cout << a << " " << b << endl; if(b%a == 0 and b/a == 2)ans = min(ans, (lli)j); } cout << ans*x << endl; } }