結果

問題 No.9005 実行時間/使用メモリテスト(テスト用)
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-08-24 14:43:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 81 ms / 3,000 ms
コード長 875 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 111,364 KB
実行使用メモリ 34,104 KB
最終ジャッジ日時 2024-04-25 15:03:58
合計ジャッジ時間 1,754 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
32,016 KB
testcase_01 AC 80 ms
32,316 KB
testcase_02 AC 81 ms
34,104 KB
testcase_03 AC 80 ms
32,232 KB
testcase_04 AC 79 ms
29,996 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;

namespace EratosthenesCS
{
    class Program
    {
        readonly static int N = 5000000;

        static List<int> SieveOfEratosthenes(int n)
        {
            bool[] isPrime = Enumerable.Repeat(true, n).ToArray();
            var primes = new List<int>();
            isPrime[0] = isPrime[1] = false;
            for (int i = 2; i < n; i++)
            {
                if (isPrime[i])
                {
                    primes.Add(i);
                    for (int j = 2 * i; j < n; j += i)
                    {
                        isPrime[j] = false;
                    }
                }
            }
            return primes;
        }

        static void Main(string[] args)
        {
            var _ = SieveOfEratosthenes(N);
            Console.WriteLine(0);
        }
    }
}
0