結果

問題 No.2379 Burnside's Theorem
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-21 16:13:05
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 1,400 bytes
コンパイル時間 6,969 ms
コンパイル使用メモリ 157,900 KB
実行使用メモリ 179,176 KB
最終ジャッジ日時 2023-10-21 16:48:51
合計ジャッジ時間 9,420 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
31,484 KB
testcase_01 AC 58 ms
31,484 KB
testcase_02 AC 58 ms
31,484 KB
testcase_03 AC 62 ms
32,356 KB
testcase_04 AC 58 ms
31,812 KB
testcase_05 AC 59 ms
31,828 KB
testcase_06 AC 59 ms
31,828 KB
testcase_07 AC 59 ms
31,832 KB
testcase_08 AC 58 ms
31,872 KB
testcase_09 AC 58 ms
31,832 KB
testcase_10 AC 59 ms
31,812 KB
testcase_11 AC 58 ms
31,828 KB
testcase_12 AC 58 ms
31,872 KB
testcase_13 AC 64 ms
32,676 KB
testcase_14 AC 64 ms
32,952 KB
testcase_15 AC 68 ms
33,420 KB
testcase_16 AC 59 ms
31,992 KB
testcase_17 AC 58 ms
31,868 KB
testcase_18 AC 66 ms
33,560 KB
testcase_19 AC 62 ms
32,364 KB
testcase_20 AC 62 ms
32,920 KB
testcase_21 AC 64 ms
33,540 KB
testcase_22 AC 57 ms
31,484 KB
testcase_23 AC 65 ms
179,176 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (99 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
public class Program{
    public static void Main(){
        var n = long.Parse(Console.ReadLine());
        var N = (long)Math.Truncate(Math.Sqrt(n));
        var k = Prime(N);
        var a = new List<long>();
        var c = false;
        for(var i=0;i<k.Count;i++){
            if(n%k[i]==0){
                while(n%k[i]==0){
                    n /= k[i];
                }
                a.Add(k[i]);
            }
            if(n==1){
                c = true;
                break;
            }
        }
        if(!c){
            a.Add(n);
        }
        if(a.Count<=2){
            Console.WriteLine("Yes");
        }
        else{
            Console.WriteLine("No");
        }
        
    }
    static List<int> Prime(long n)
    {
        var isPrime = new bool[n+1];
        var k = new List<int>();
        for (int i = 2; i <= n; i++)
        {
            isPrime[i] = true;
        }
    
        for (int i = 2; i * i <= n; i++)
        {
            if (isPrime[i])
            {
                for (int j = i * i; j <= n; j += i)
                {
                    isPrime[j] = false;
                }
            }
        }
    
        for (int i = 2; i <= n; i++)
        {
            if (isPrime[i])
            {
                k.Add(i);
            }
        }
        return k;
    }
}
0