結果
問題 |
No.1611 Minimum Multiple with Double Divisors
|
ユーザー |
|
提出日時 | 2021-07-21 22:17:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,499 bytes |
コンパイル時間 | 1,773 ms |
コンパイル使用メモリ | 175,052 KB |
実行使用メモリ | 13,824 KB |
最終ジャッジ日時 | 2024-07-17 19:10:47 |
合計ジャッジ時間 | 8,419 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | TLE * 1 -- * 36 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:31:26: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 31 | for(auto [v, ko]: m){ | ^
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int testcase; cin >> testcase; vector<int> prime(100, -1); for(int i = 2; i < 100; i++){ if(prime[i] != -1) continue; int t = i; prime[i] = i; while(t + i < 100){ t += i; prime[t] = i; } } while(testcase--){ long long X; cin >> X; if(X % 2 == 1) cout << X * 2 << endl; else{ long long res = 1000000000000000; for(long long i = 2; i < 100; i++){ map<int, int> m; int t = i; while(t != 1){ m[prime[t]]++; t /= prime[t]; } long long cnt = 1; long long pre = 1; for(auto [v, ko]: m){ long long temp = X * i; long long te = 0; while(temp % v == 0){ temp /= v; te++; } temp = X; cnt *= te + 1; te = 0; while(temp % v == 0){ temp /= v; te++; } pre *= te + 1; } if(cnt % pre == 0 && cnt / pre == 2){ res = min(res, i); } } cout << X * res << endl; } } }