結果

問題 No.713 素数の和
ユーザー _matumo__matumo_
提出日時 2018-07-18 19:51:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 104,536 KB
実行使用メモリ 23,720 KB
最終ジャッジ日時 2023-08-22 07:14:05
合計ジャッジ時間 3,784 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,704 KB
testcase_01 AC 57 ms
21,664 KB
testcase_02 AC 59 ms
21,692 KB
testcase_03 AC 59 ms
23,720 KB
testcase_04 AC 59 ms
21,564 KB
testcase_05 AC 61 ms
21,504 KB
testcase_06 AC 61 ms
21,780 KB
testcase_07 AC 59 ms
21,536 KB
testcase_08 AC 59 ms
23,656 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;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var pr = new List<int>() { 0 };
            var pa = Enumerable.Range(2, N - 1).ToList();
            for (int k = 1; k * k < N; )
            {
                k = pa[0];
                pr.Add(k);
                pa.RemoveAll(x => x % k == 0);
            }
            pr.AddRange(pa);
            Console.WriteLine(pr.Sum());
            Console.ReadLine();
        }
    }
}
0