結果

問題 No.2379 Burnside's Theorem
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-21 15:53:22
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,302 bytes
コンパイル時間 19,458 ms
コンパイル使用メモリ 158,060 KB
実行使用メモリ 178,624 KB
最終ジャッジ日時 2023-10-21 16:30:47
合計ジャッジ時間 23,158 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
31,332 KB
testcase_01 AC 58 ms
31,332 KB
testcase_02 AC 59 ms
31,332 KB
testcase_03 AC 65 ms
32,272 KB
testcase_04 AC 60 ms
31,728 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 60 ms
31,788 KB
testcase_09 WA -
testcase_10 AC 60 ms
31,728 KB
testcase_11 AC 59 ms
31,744 KB
testcase_12 AC 59 ms
31,788 KB
testcase_13 AC 65 ms
32,604 KB
testcase_14 AC 65 ms
32,880 KB
testcase_15 AC 67 ms
33,348 KB
testcase_16 AC 60 ms
31,908 KB
testcase_17 AC 59 ms
31,784 KB
testcase_18 AC 70 ms
33,488 KB
testcase_19 AC 65 ms
32,280 KB
testcase_20 AC 64 ms
32,836 KB
testcase_21 AC 65 ms
33,456 KB
testcase_22 AC 58 ms
31,332 KB
testcase_23 AC 65 ms
178,624 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (104 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<int>();
        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;
            }
        }
        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