結果

問題 No.2379 Burnside's Theorem
ユーザー bluemeganebluemegane
提出日時 2023-07-14 22:21:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 2,827 ms
コンパイル使用メモリ 103,168 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-09-16 07:26:51
合計ジャッジ時間 4,377 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        getAns(n);
    }
    static void getAns(long n)
    {
        var d = PF(n);
        Console.WriteLine(d.Count <=2? "Yes":"No");
    }
    static Dictionary<long, int> PF(long n)
    {
        var d = new Dictionary<long, int>();
        for (long i = 2; i * i <= n; i++)
        {
            if (n % i != 0) continue;
            var x = 0;
            while (n % i == 0)
            {
                x++;
                n /= i;
            }
            d[i] = x;
        }
        if (n != 1) d[n] = 1;
        return d;
    }
}
0