結果

問題 No.888 約数の総和
ユーザー tonyu0
提出日時 2019-10-25 19:27:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 63,104 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 16:35:40
合計ジャッジ時間 1,972 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long;

ll N;
int main() {
  cin.tie(0); ios_base::sync_with_stdio(false); 
  cin >> N;
  ll ans = 0;
  for(ll i = 1; i * i <= N; ++i) {
    if(N % i == 0) {
      ans += i;
      if(N / i != i) ans += N / i;
    }
  }
  cout << ans << endl;
  return 0;
}
0