結果

問題 No.2480 Sequence Sum
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-24 23:23:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 500 ms
コード長 797 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 63,988 KB
実行使用メモリ 24,720 KB
最終ジャッジ日時 2023-10-04 12:35:29
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,400 KB
testcase_01 AC 57 ms
22,528 KB
testcase_02 AC 58 ms
22,636 KB
testcase_03 AC 58 ms
22,528 KB
testcase_04 AC 58 ms
22,496 KB
testcase_05 AC 58 ms
22,428 KB
testcase_06 AC 58 ms
22,484 KB
testcase_07 AC 59 ms
22,616 KB
testcase_08 AC 59 ms
24,720 KB
testcase_09 AC 58 ms
24,648 KB
testcase_10 AC 58 ms
24,472 KB
testcase_11 AC 58 ms
24,672 KB
testcase_12 AC 59 ms
22,488 KB
testcase_13 AC 58 ms
22,688 KB
testcase_14 AC 59 ms
22,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        WriteLine(n - Divs(n).Count);
    }
    static HashSet<int> Divs(int n)
    {
        var ans = new HashSet<int>();
        for (var i = 1; i * i <= n; ++i)
        {
            if (n % i == 0)
            {
                ans.Add(i);
                ans.Add(n / i);
            }
        }
        return ans;
    }
}
0