結果
問題 |
No.1737 One to N
|
ユーザー |
![]() |
提出日時 | 2022-08-06 23:58:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 1,742 ms |
コンパイル使用メモリ | 172,736 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 17:43:02 |
合計ジャッジ時間 | 2,861 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> mp; for (int i = 2; i * i <= n; i++) { while (n % i == 0) { mp[i]++; n /= i; } } if (n > 1) mp[n]++; long long ans = 0; for (auto i : mp) { ans += i.first * i.second; } cout << ans << endl; return 0; }