結果

問題 No.888 約数の総和
ユーザー yuppe19 😺
提出日時 2019-10-30 21:17:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 27,264 KB
最終ジャッジ日時 2025-01-08 02:08:38
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   u64 N; scanf("%lu", &N);
      |          ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <cstdint>
#include <cstdio>
using u64 = uint64_t;

int main(void) {
  u64 N; scanf("%lu", &N);
  u64 res = 0;
  for(u64 d=1; d*d<=N; ++d) {
    if(N % d == 0) {
      res += d;
      if(d != N/d) {
        res += N/d;
      }
    }
  }
  printf("%lu\n", res);
  return 0;
}
0