結果
問題 |
No.888 約数の総和
|
ユーザー |
![]() |
提出日時 | 2019-09-21 16:36:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 1,406 ms |
コンパイル使用メモリ | 164,948 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-19 01:58:32 |
合計ジャッジ時間 | 2,400 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; typedef pair<ll, ll> P; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);} const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2; //template end int main(){ ll n,ans=0; scanf("%lld",&n); for(ll p=1;p*p<=n;p++){ if(n%p==0){ ans+=p; if(p<n/p)ans+=n/p; } } printf("%lld\n",ans); return 0; }