結果

問題 No.888 約数の総和
ユーザー bluemeganebluemegane
提出日時 2021-04-19 07:53:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 518 bytes
コンパイル時間 757 ms
コンパイル使用メモリ 65,076 KB
実行使用メモリ 22,824 KB
最終ジャッジ日時 2023-09-17 08:15:21
合計ジャッジ時間 4,038 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,784 KB
testcase_01 AC 55 ms
22,572 KB
testcase_02 AC 55 ms
22,728 KB
testcase_03 AC 55 ms
20,660 KB
testcase_04 AC 55 ms
22,728 KB
testcase_05 AC 55 ms
20,740 KB
testcase_06 AC 54 ms
18,620 KB
testcase_07 AC 55 ms
22,648 KB
testcase_08 AC 56 ms
22,656 KB
testcase_09 AC 56 ms
20,740 KB
testcase_10 AC 57 ms
22,736 KB
testcase_11 AC 57 ms
20,784 KB
testcase_12 AC 57 ms
20,696 KB
testcase_13 AC 57 ms
20,556 KB
testcase_14 AC 56 ms
20,600 KB
testcase_15 AC 56 ms
22,740 KB
testcase_16 AC 55 ms
20,572 KB
testcase_17 AC 54 ms
20,740 KB
testcase_18 AC 66 ms
20,640 KB
testcase_19 AC 63 ms
20,688 KB
testcase_20 AC 62 ms
20,628 KB
testcase_21 AC 66 ms
20,720 KB
testcase_22 AC 67 ms
20,776 KB
testcase_23 AC 55 ms
20,656 KB
testcase_24 AC 60 ms
20,700 KB
testcase_25 AC 61 ms
20,728 KB
testcase_26 AC 61 ms
20,708 KB
testcase_27 AC 64 ms
18,644 KB
testcase_28 AC 64 ms
22,652 KB
testcase_29 AC 64 ms
20,624 KB
testcase_30 AC 65 ms
22,824 KB
testcase_31 AC 66 ms
18,656 KB
testcase_32 AC 68 ms
20,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns (long n)
    {
        var imax = (int)Sqrt(n);
        var ans = 0L;
        for (int i = 1; i <= imax; i++)
        {
            if (n % i == 0)
            {
                ans += i;
                var t1 = n / i;
                if (t1 != i) ans += t1;
            }
        }
        Console.WriteLine(ans);
    }
}
0