結果

問題 No.2379 Burnside's Theorem
ユーザー kakel-san
提出日時 2023-07-14 22:43:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 974 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 104,704 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-09-16 07:47:04
合計ジャッジ時間 2,387 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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