結果

問題 No.2379 Burnside's Theorem
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-21 16:04:18
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,366 bytes
コンパイル時間 7,076 ms
コンパイル使用メモリ 160,440 KB
実行使用メモリ 179,240 KB
最終ジャッジ日時 2023-10-21 16:41:10
合計ジャッジ時間 9,728 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
31,328 KB
testcase_01 AC 59 ms
31,328 KB
testcase_02 AC 57 ms
31,328 KB
testcase_03 AC 60 ms
32,268 KB
testcase_04 WA -
testcase_05 AC 59 ms
31,740 KB
testcase_06 AC 59 ms
31,740 KB
testcase_07 AC 59 ms
31,744 KB
testcase_08 WA -
testcase_09 AC 59 ms
31,744 KB
testcase_10 WA -
testcase_11 AC 59 ms
31,740 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 60 ms
31,904 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 61 ms
32,276 KB
testcase_20 AC 64 ms
32,832 KB
testcase_21 AC 65 ms
33,452 KB
testcase_22 WA -
testcase_23 AC 66 ms
179,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 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>();
        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.Count<=2&&a.Count!=0){
            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