結果
問題 | No.888 約数の総和 |
ユーザー |
|
提出日時 | 2020-03-20 17:08:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 578 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 178,824 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-14 10:26:57 |
合計ジャッジ時間 | 2,982 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
typedef long long ll; #include <bits/stdc++.h> using namespace std; int main() { ll n; std::cin >> n; map<ll,ll> e; for (int i = 2; i <= sqrt(n); i++) { while(n%i==0){ e[i]++; n/=i; } } if(n!=1){ e[n]++; } vector<ll> res; for (auto ee : e) { ll tmp = 0; for (int i = 0; i <= ee.second; i++) { tmp += pow(ee.first,i); } res.push_back(tmp); } ll ans = 1; for (auto ee : res) { ans *= ee; } std::cout << ans << std::endl; }