結果

問題 No.312 置換処理
ユーザー nanophoto12
提出日時 2015-12-06 12:20:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 2,385 ms
コンパイル使用メモリ 109,720 KB
実行使用メモリ 25,960 KB
最終ジャッジ日時 2024-11-15 11:52:32
合計ジャッジ時間 4,236 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No312
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			long n = Convert.ToInt64 (Console.ReadLine ());

			if (n == 4) {
				Console.WriteLine ("4");
				return;
			}

			long a = n;
			if (n % 2 == 0) {				
				a = n / 2;
			}
			for (long i = 3; i * i <= n; i++) {
				if (n % i == 0) {
					Console.WriteLine (i.ToString ());
					return;
				}
			}
			Console.WriteLine (a.ToString ());
		}
	}
}
0