結果
問題 | No.713 素数の和 |
ユーザー |
![]() |
提出日時 | 2018-07-13 22:40:12 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 862 ms |
コンパイル使用メモリ | 106,204 KB |
実行使用メモリ | 25,824 KB |
最終ジャッジ日時 | 2024-10-09 05:20:05 |
合計ジャッジ時間 | 1,673 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);}}}