結果

問題 No.36 素数が嫌い!
ユーザー pirorirori_n712pirorirori_n712
提出日時 2018-11-01 09:54:57
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 813 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-04-30 03:01:12
合計ジャッジ時間 17,819 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
17,280 KB
testcase_01 AC 135 ms
17,664 KB
testcase_02 AC 22 ms
17,664 KB
testcase_03 AC 22 ms
17,792 KB
testcase_04 AC 22 ms
17,408 KB
testcase_05 AC 4,346 ms
17,664 KB
testcase_06 TLE -
testcase_07 AC 22 ms
17,280 KB
testcase_08 AC 23 ms
17,536 KB
testcase_09 AC 23 ms
17,664 KB
testcase_10 AC 23 ms
17,536 KB
testcase_11 AC 60 ms
17,536 KB
testcase_12 AC 137 ms
17,408 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class No36
{
    static void Main()
    {
        var num = Int64.Parse(Console.ReadLine());
        if (IsPrimeNumber(num))
        {
            Console.WriteLine("NO");
            return;
        }
        var ans = "NO";
        //var s = Math.Sqrt(num) + 1;
        var s = (num + 1) / 2;
        for (long i = 2; i < s; i++)
        {
            if (num % i == 0) { 
                if (!IsPrimeNumber(i))
                {
                    ans = "YES";
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }
    static bool IsPrimeNumber(long num)
    {
        if (num == 1 || num == 2) return true;
        var s = Math.Sqrt(num) + 1;
        for (long i = 2; i < s; i++) if (num % i == 0) return false;
        return true;
    }
}
0