結果

問題 No.888 約数の総和
ユーザー curryudon08
提出日時 2020-07-03 17:07:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,491 ms
コンパイル使用メモリ 103,296 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2024-09-16 17:16:30
合計ジャッジ時間 2,981 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Numerics;

namespace _0888
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var x = DivisorSum(n);
            Console.WriteLine(x);
        }

        static BigInteger DivisorSum(long n){
            BigInteger s = 0;
            for(var i = 1L; i * i <= n; i++){
                if(n % i == 0){
                    s += i;
                    if(i * i != n){
                        s += (n / i);
                    }
                }
            }
            return s;
        }
    }
}
0