結果
問題 | No.1737 One to N |
ユーザー |
![]() |
提出日時 | 2021-11-12 21:38:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 1,443 ms |
コンパイル使用メモリ | 165,916 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 17:29:36 |
合計ジャッジ時間 | 2,268 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>#define fi first#define se second#define pb push_back#define sz(a) (int)a.size()#define all(a) a.begin(),a.end()#define rep(i,n) for(int i=0;i<n;i++)#define crep(i,x,n) for(int i=x;i<n;i++)#define drep(i,n) for(int i=n-1;i>=0;i--)#define vec(...) vector<__VA_ARGS__>#define _3pPbCt8 ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)using namespace std;typedef long long ll;typedef long double ld;using pii=pair<int,int>;using vi=vector<int>;int main(){_3pPbCt8;int n;cin>>n;if(n==1){cout<<"0\n";exit(0);}int a=n,ans=0;for(int i=2;i<=sqrt(n);i++){int cnt=0;while(a%i==0){a/=i;cnt++;}ans+=cnt*i;}if(a>1) ans+=a;cout<<ans<<"\n";//return 0;}