結果
問題 | No.1737 One to N |
ユーザー |
|
提出日時 | 2023-06-26 16:26:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 601 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 170,860 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 11:25:53 |
合計ジャッジ時間 | 2,174 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using Graph = vector<vector<int>>;using ull = unsigned long long;int main() {long long N; cin >> N;long long ans = 1ll << 60ll;vector<int> a;if(N == 1) {cout << 0 << endl; return 0;}while(true) {bool fire = true;for(int i = 2; i <= sqrt(N); i++) {if(N % i == 0){N /= i;fire =false;a.push_back(i);break;}}if(fire) break;}a.push_back(N);ans = 0;for(int i = 0; i < a.size(); i++) {ans += a[i];}cout << ans << endl;}