結果
問題 | No.1737 One to N |
ユーザー |
|
提出日時 | 2022-09-27 12:57:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 1,848 ms |
コンパイル使用メモリ | 196,864 KB |
最終ジャッジ日時 | 2025-02-07 17:13:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i = 0; i < (n); i++)using namespace std;typedef long long ll;vector<pair<long long, long long>> prime_factorize(long long N){vector<pair<long long, long long>> res;for(long long a = 2; a * a <= N; ++a){if(N % a != 0) continue;long long ex = 0;while(N % a == 0) ++ex, N /= a;res.push_back({a,ex});}if(N != 1) res.push_back({N,1});return res;}int main(){cin.tie(0);ios::sync_with_stdio(0);ll N; cin >> N;auto pf = prime_factorize(N);ll ans = 0;for(auto [p, e] : pf) ans += p * e;cout << ans << endl;}