結果

問題 No.312 置換処理
ユーザー Grenache
提出日時 2015-12-05 00:46:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 3,692 ms
コンパイル使用メモリ 74,468 KB
実行使用メモリ 41,788 KB
最終ジャッジ日時 2024-11-15 11:47:19
合計ジャッジ時間 11,285 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder312 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long ret = n;
        if (n != 4 && n % 2 == 0) {
        	ret = n / 2;
        }

        for (long j = 3; j * j <= n; j++) {
        	if (n % j == 0) {
        		System.out.println(Math.min(ret, j));

        		sc.close();
        		return;
        	}
        }

		System.out.println(Math.min(ret, n));

        sc.close();
    }
}
0