結果

問題 No.713 素数の和
ユーザー NoNo
提出日時 2018-07-13 22:38:28
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 96,192 KB
実行使用メモリ 22,896 KB
最終ジャッジ日時 2023-07-30 09:48:05
合計ジャッジ時間 3,328 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
18,720 KB
testcase_01 AC 56 ms
18,596 KB
testcase_02 WA -
testcase_03 AC 58 ms
20,692 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 57 ms
20,716 KB
testcase_08 AC 58 ms
22,708 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;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = new List<int>();
            int a = 0;
            for (int i = 2; i < n; i++)
            {
                if (s.Contains(i)) continue;
                else
                {
                    a += i;
                    int e = i;
                    int c = 2;
                    while (e * c <= n)
                    {
                        s.Add(e * c);
                        c++;
                    }
                }
            }

            Console.WriteLine(a);
        }
    }
}
0