結果

問題 No.888 約数の総和
ユーザー Mayimg
提出日時 2019-09-25 04:37:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 190,880 KB
最終ジャッジ日時 2025-01-07 19:07:24
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i) continue;
    ans += i;
    ans += n / i;
    if (i == n / i) ans -= i;
  }
  cout << ans << '\n';
  return 0;
}
0