結果
| 問題 |
No.888 約数の総和
|
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2019-10-07 07:37:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 788 bytes |
| コンパイル時間 | 1,588 ms |
| コンパイル使用メモリ | 169,548 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 12:39:25 |
| 合計ジャッジ時間 | 2,655 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 14 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
vector<pll> prime_factorize(ll n) {
vector<pll> res;
for (ll p = 2; p * p <= n; ++p) {
if (n % p != 0) continue;
int num = 0;
while (n % p == 0) { ++num; n /= p; }
res.push_back((pll){p, num});
}
if (n != 1) res.push_back((pll){n, 1});
return res;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
ll ans = 1LL;
auto v = prime_factorize(n);
for(auto pk : v){
ll p = pk.first;
ll k = pk.second;
ll s = 0LL;
ll t = 1LL;
for(int i = 0; i < k+1; i++){
s += t;
t *= p;
}
// cout << p << "," << s << endl;
ans *= s;
}
cout << ans << endl;
}
misora192