結果
問題 | No.1737 One to N |
ユーザー |
|
提出日時 | 2024-03-21 09:48:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 3,769 ms |
コンパイル使用メモリ | 255,264 KB |
最終ジャッジ日時 | 2025-02-20 10:31:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int N; ll ans = 0; map<int, int> prime_factors(int n) { map<int, int> res; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } int main() { cin >> N; auto res = prime_factors(N); for (auto p: res) { ans += (ll)p.first * p.second; } cout << ans << endl; return 0; }