結果

問題 No.2379 Burnside's Theorem
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-21 16:10:52
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,321 bytes
コンパイル時間 8,752 ms
コンパイル使用メモリ 157,572 KB
実行使用メモリ 178,368 KB
最終ジャッジ日時 2023-10-21 16:46:59
合計ジャッジ時間 11,374 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 59 ms
31,496 KB
testcase_02 AC 61 ms
31,496 KB
testcase_03 AC 62 ms
32,372 KB
testcase_04 AC 61 ms
31,828 KB
testcase_05 AC 61 ms
31,844 KB
testcase_06 AC 60 ms
31,844 KB
testcase_07 AC 60 ms
31,848 KB
testcase_08 AC 61 ms
31,888 KB
testcase_09 AC 60 ms
31,848 KB
testcase_10 AC 60 ms
31,828 KB
testcase_11 AC 61 ms
31,844 KB
testcase_12 AC 61 ms
31,888 KB
testcase_13 AC 64 ms
32,692 KB
testcase_14 AC 66 ms
32,968 KB
testcase_15 AC 67 ms
33,436 KB
testcase_16 AC 61 ms
32,008 KB
testcase_17 AC 61 ms
31,884 KB
testcase_18 AC 69 ms
33,576 KB
testcase_19 AC 64 ms
32,380 KB
testcase_20 AC 65 ms
32,936 KB
testcase_21 AC 67 ms
33,556 KB
testcase_22 AC 59 ms
31,496 KB
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (160 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>();
        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){
                break;
            }
        }
        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