結果

問題 No.2379 Burnside's Theorem
ユーザー 👑 kakel-sankakel-san
提出日時 2023-07-14 22:43:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 974 bytes
コンパイル時間 1,156 ms
コンパイル使用メモリ 65,168 KB
実行使用メモリ 22,712 KB
最終ジャッジ日時 2023-10-14 13:00:06
合計ジャッジ時間 3,781 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,688 KB
testcase_01 AC 54 ms
20,696 KB
testcase_02 AC 56 ms
18,512 KB
testcase_03 AC 55 ms
22,644 KB
testcase_04 AC 53 ms
20,768 KB
testcase_05 AC 54 ms
18,452 KB
testcase_06 AC 54 ms
20,668 KB
testcase_07 AC 54 ms
20,688 KB
testcase_08 AC 53 ms
20,596 KB
testcase_09 AC 54 ms
20,516 KB
testcase_10 AC 54 ms
20,608 KB
testcase_11 AC 54 ms
22,644 KB
testcase_12 AC 54 ms
22,552 KB
testcase_13 AC 56 ms
20,512 KB
testcase_14 AC 57 ms
22,712 KB
testcase_15 AC 59 ms
20,496 KB
testcase_16 AC 54 ms
20,608 KB
testcase_17 AC 55 ms
20,652 KB
testcase_18 AC 60 ms
20,816 KB
testcase_19 AC 54 ms
22,712 KB
testcase_20 AC 56 ms
20,556 KB
testcase_21 AC 54 ms
20,556 KB
testcase_22 AC 51 ms
20,724 KB
testcase_23 AC 54 ms
20,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static long NN => long.Parse(ReadLine());
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var p = PDiv(NN);
        WriteLine(p.Count < 3 ? "Yes" : "No");
    }
    static Dictionary<long, long> PDiv(long n)
    {
        var dic = new Dictionary<long, long>();
        var tmp = n;
        while (tmp % 2 == 0)
        {
            tmp /= 2;
            if (dic.ContainsKey(2)) ++dic[2];
            else dic.Add(2, 1);
        }
        for (var p = 3L; p * p <= n; p += 2)
        {
            while (tmp % p == 0)
            {
                tmp /= p;
                if (dic.ContainsKey(p)) ++dic[p];
                else dic.Add(p, 1);
            }
            if (tmp == 1) break;
        }
        if (tmp > 1) dic.Add(tmp, 1);
        return dic;
    }
}
0