結果

問題 No.192 合成数
ユーザー nanophoto12nanophoto12
提出日時 2015-12-13 22:06:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 106,520 KB
実行使用メモリ 22,824 KB
最終ジャッジ日時 2023-09-09 08:45:00
合計ジャッジ時間 4,751 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
22,712 KB
testcase_01 AC 53 ms
20,752 KB
testcase_02 AC 52 ms
22,808 KB
testcase_03 AC 52 ms
20,712 KB
testcase_04 AC 52 ms
20,908 KB
testcase_05 AC 53 ms
20,796 KB
testcase_06 AC 53 ms
22,800 KB
testcase_07 AC 52 ms
18,716 KB
testcase_08 AC 53 ms
20,696 KB
testcase_09 AC 53 ms
20,644 KB
testcase_10 AC 53 ms
20,864 KB
testcase_11 AC 53 ms
22,752 KB
testcase_12 AC 52 ms
22,808 KB
testcase_13 AC 53 ms
20,800 KB
testcase_14 AC 52 ms
20,728 KB
testcase_15 AC 53 ms
20,752 KB
testcase_16 AC 53 ms
20,772 KB
testcase_17 AC 54 ms
20,768 KB
testcase_18 AC 53 ms
22,824 KB
testcase_19 AC 54 ms
20,884 KB
testcase_20 AC 52 ms
20,832 KB
testcase_21 AC 53 ms
20,916 KB
testcase_22 AC 53 ms
20,808 KB
testcase_23 AC 53 ms
22,760 KB
testcase_24 AC 53 ms
20,684 KB
testcase_25 AC 52 ms
20,708 KB
testcase_26 AC 53 ms
20,672 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 No192
{
	class MainClass
	{
		private static bool IsPrime(int value)
		{
			for (int i = 2; i * i <= value; i++) {
				if (value % i == 0) {
					return false;
				}
			}
			return true;
		}

		public static void Main (string[] args)
		{
			var n = Convert.ToInt32 (Console.ReadLine ());
			for(int i = Math.Max(4, n - 100);i <= n + 100;i++)
			{
				if (!IsPrime (i)) {
					Console.WriteLine (i.ToString ());
					return;
				}
			}
		}
	}
}
0