結果
| 問題 |
No.1737 One to N
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-16 01:16:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 828 bytes |
| コンパイル時間 | 1,642 ms |
| コンパイル使用メモリ | 169,876 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 23:30:03 |
| 合計ジャッジ時間 | 2,583 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
using LL = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const long long LINF = 1LL << 60;
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); ++i)
template<class T>void chmin(T&a, T b){if(a > b) a = b;}
template<class T>void chmax(T&a, T b){if(a < b) a = b;}
vector<pair<LL, LL>> prime_factorize(LL N){
vector<pair<LL, LL>> res;
for(LL a = 2; a*a <= N; ++a){
if(N%a != 0) continue;
LL 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(){
//入力
LL N; cin >> N;
const auto &pf = prime_factorize(N);
LL res = 0;
for(auto p : pf) res += p.first * p.second;
cout << res << endl;
}