結果
| 問題 |
No.1737 One to N
|
| コンテスト | |
| ユーザー |
yukster714
|
| 提出日時 | 2023-05-06 16:18:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 453 bytes |
| コンパイル時間 | 604 ms |
| コンパイル使用メモリ | 72,320 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 23:31:25 |
| 合計ジャッジ時間 | 1,580 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> factor(int n){
vector<int>ret;
while(n%2==0){
ret.push_back(2);
n/=2;
}
for(int i=3;i*i<=n;i+=2){
while(n%i==0){
ret.push_back(i);
n/=i;
}
}
if(n!=1)ret.push_back(n);
return ret;
}
int main() {
int n; cin>>n;
int sum = 0;
for(int m: factor(n)){
sum+=m;
}
cout << sum << endl;
return 0;
}
yukster714