結果
| 問題 |
No.811 約数の個数の最大化
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2019-04-13 12:54:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 720 bytes |
| コンパイル時間 | 1,721 ms |
| コンパイル使用メモリ | 174,052 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 08:24:39 |
| 合計ジャッジ時間 | 14,164 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 TLE * 1 |
| other | WA * 9 TLE * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
map<int, int> mp;
for (int i = 2, j = n; j != 1; i++) {
while (j % i == 0) {
mp[i]++;
j /= i;
}
}
int num = 0, ans = 0;
for (int i = 2; i < n; i++) {
map<int, int> tmp;
for (int j = 2, k = i; k != 1; j++) {
while (k % j == 0) {
tmp[j]++;
k /= j;
}
}
int puni = 0;
for (auto &p : mp) {
puni += min(p.second, tmp[p.first]);
}
if (num < puni) {
num = puni;
ans = i;
}
}
cout << ans << endl;
return 0;
}
ldsyb