結果

問題 No.36 素数が嫌い!
ユーザー うわばみうわばみ
提出日時 2020-04-29 22:07:23
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 108,416 KB
実行使用メモリ 27,968 KB
最終ジャッジ日時 2024-05-07 10:21:51
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        long n = long.Parse(Console.ReadLine());
        if(!IsPrime(n))
        {
            Console.WriteLine($"YES");
        }
        else
        {
            Console.WriteLine($"NO");
        }
    }

    public static bool IsPrime(long number)
    {
        if(number <= 2)
            return true;
        else if(number % 2 == 0)
            return false;

        for(long i = 3; i * i <= number; i += 2)
        {
            if(number % i == 0)
            {
                return false;
            }
        }
        return true;
    }
}
0