結果

問題 No.36 素数が嫌い!
ユーザー nanophoto12
提出日時 2014-11-02 04:16:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 2,616 ms
コンパイル使用メモリ 103,296 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-12-30 16:14:29
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 19 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    public static void Main(string[] args)
    {
        long n = long.Parse(Console.ReadLine());
        long upper = (long)Math.Min(Math.Sqrt(n) + 1, n - 1);
        int primeCount = 0;
        for (long i = 2; i <= Math.Sqrt(upper); i++)
        {
            if (n%i == 0)
            {
                primeCount++;
            }
        }
        if (primeCount >= 3)
        {
            Console.WriteLine("YES");
            return;
        }
        Console.WriteLine("NO");        
    }
}
0