結果

問題 No.888 約数の総和
ユーザー tomomo2b2tomomo2b2
提出日時 2019-10-11 17:57:07
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,149 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 101,120 KB
実行使用メモリ 23,304 KB
最終ジャッジ日時 2023-08-16 11:25:02
合計ジャッジ時間 5,681 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
21,004 KB
testcase_01 AC 58 ms
20,876 KB
testcase_02 AC 60 ms
23,244 KB
testcase_03 AC 56 ms
22,872 KB
testcase_04 AC 57 ms
23,116 KB
testcase_05 AC 57 ms
21,236 KB
testcase_06 AC 58 ms
21,252 KB
testcase_07 AC 57 ms
23,284 KB
testcase_08 AC 58 ms
21,340 KB
testcase_09 AC 58 ms
23,304 KB
testcase_10 AC 57 ms
23,296 KB
testcase_11 AC 59 ms
21,280 KB
testcase_12 AC 59 ms
21,264 KB
testcase_13 AC 58 ms
21,308 KB
testcase_14 AC 58 ms
19,196 KB
testcase_15 AC 58 ms
21,240 KB
testcase_16 AC 58 ms
20,948 KB
testcase_17 AC 58 ms
21,192 KB
testcase_18 AC 58 ms
21,192 KB
testcase_19 AC 58 ms
23,240 KB
testcase_20 AC 58 ms
21,344 KB
testcase_21 AC 58 ms
21,280 KB
testcase_22 AC 60 ms
21,240 KB
testcase_23 AC 58 ms
21,332 KB
testcase_24 AC 59 ms
23,176 KB
testcase_25 AC 59 ms
23,252 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 57 ms
21,276 KB
testcase_30 WA -
testcase_31 AC 58 ms
21,200 KB
testcase_32 AC 58 ms
21,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static void Solve()
    {
        var N = long.Parse(Console.ReadLine());
        var exp = new Dictionary<long, long>();
        long sum = 1;
        if (N % 2 == 0)
        {
            exp.Add(2, 0);
            while (N % 2 == 0)
            {
                N /= 2;
                exp[2]++;
            }
        }
        for (long p = 3; p * p <= N; p += 2)
        {
            if (N % p == 0)
            {
                exp.Add(p, 0);
                while (N % p == 0)
                {
                    N /= p;
                    exp[p]++;
                }
            }
        }
        if (N != 1)
        {
            exp.Add(N, 1);
        }
        foreach (var p in exp.Keys)
        {
            sum *= ((long)Math.Pow(p, exp[p] + 1) - 1) / (p - 1);
        }
        Console.WriteLine(sum);
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
0