結果

問題 No.312 置換処理
ユーザー spaciaspacia
提出日時 2016-01-09 10:37:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 2,161 ms
コンパイル使用メモリ 74,628 KB
実行使用メモリ 54,140 KB
最終ジャッジ日時 2023-10-19 16:53:13
合計ジャッジ時間 5,835 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
53,500 KB
testcase_01 WA -
testcase_02 AC 67 ms
52,036 KB
testcase_03 WA -
testcase_04 AC 53 ms
53,500 KB
testcase_05 AC 54 ms
53,528 KB
testcase_06 AC 55 ms
52,464 KB
testcase_07 AC 58 ms
51,508 KB
testcase_08 AC 54 ms
53,500 KB
testcase_09 AC 54 ms
52,412 KB
testcase_10 AC 54 ms
52,516 KB
testcase_11 AC 54 ms
52,476 KB
testcase_12 AC 54 ms
53,500 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 54 ms
52,440 KB
testcase_23 AC 53 ms
52,484 KB
testcase_24 AC 55 ms
53,504 KB
testcase_25 WA -
testcase_26 AC 54 ms
53,516 KB
testcase_27 AC 53 ms
52,464 KB
testcase_28 AC 55 ms
53,508 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 56 ms
52,512 KB
testcase_33 AC 60 ms
53,504 KB
testcase_34 AC 59 ms
52,832 KB
testcase_35 AC 54 ms
53,516 KB
testcase_36 AC 53 ms
53,500 KB
testcase_37 AC 55 ms
52,468 KB
testcase_38 WA -
testcase_39 AC 54 ms
53,500 KB
testcase_40 AC 54 ms
53,500 KB
testcase_41 AC 53 ms
53,504 KB
testcase_42 AC 55 ms
53,496 KB
testcase_43 AC 53 ms
53,508 KB
testcase_44 AC 53 ms
53,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static long solve (long n) {
		long k = n;
		while (k % 2 == 0) k /= 2;
		if (k == 1) return 4;
		
		for (long i = 3; i * i <= n; i += 2) {
			if (n % i == 0) return i;
		}
		return n;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		long n = Long.parseLong(br.readLine());
		
		out(solve(n));
	}
}
0