結果

問題 No.312 置換処理
ユーザー spaciaspacia
提出日時 2016-01-09 10:42:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 75,264 KB
実行使用メモリ 54,128 KB
最終ジャッジ日時 2023-10-19 16:54:31
合計ジャッジ時間 6,456 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
52,504 KB
testcase_01 AC 69 ms
54,048 KB
testcase_02 AC 73 ms
54,128 KB
testcase_03 AC 71 ms
54,036 KB
testcase_04 AC 59 ms
52,488 KB
testcase_05 AC 58 ms
52,436 KB
testcase_06 AC 58 ms
53,560 KB
testcase_07 AC 69 ms
53,560 KB
testcase_08 AC 59 ms
52,516 KB
testcase_09 AC 57 ms
52,540 KB
testcase_10 AC 58 ms
53,548 KB
testcase_11 AC 60 ms
53,552 KB
testcase_12 AC 59 ms
52,496 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 58 ms
52,464 KB
testcase_23 AC 57 ms
53,568 KB
testcase_24 AC 58 ms
53,564 KB
testcase_25 AC 58 ms
50,480 KB
testcase_26 AC 58 ms
53,548 KB
testcase_27 AC 59 ms
52,456 KB
testcase_28 AC 56 ms
52,524 KB
testcase_29 AC 56 ms
52,456 KB
testcase_30 AC 63 ms
52,512 KB
testcase_31 WA -
testcase_32 AC 62 ms
52,432 KB
testcase_33 AC 63 ms
53,612 KB
testcase_34 AC 65 ms
53,568 KB
testcase_35 AC 57 ms
53,556 KB
testcase_36 AC 57 ms
52,460 KB
testcase_37 AC 59 ms
52,476 KB
testcase_38 WA -
testcase_39 AC 59 ms
52,468 KB
testcase_40 AC 56 ms
53,548 KB
testcase_41 AC 57 ms
52,524 KB
testcase_42 AC 63 ms
53,560 KB
testcase_43 AC 57 ms
53,548 KB
testcase_44 AC 57 ms
53,556 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 k;
	}
	
	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