結果

問題 No.312 置換処理
ユーザー ぴろずぴろず
提出日時 2015-12-05 00:12:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 2,827 ms
コンパイル使用メモリ 70,896 KB
実行使用メモリ 56,504 KB
最終ジャッジ日時 2023-08-09 15:34:16
合計ジャッジ時間 9,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,920 KB
testcase_01 AC 130 ms
55,796 KB
testcase_02 AC 137 ms
56,020 KB
testcase_03 AC 136 ms
55,576 KB
testcase_04 AC 122 ms
55,588 KB
testcase_05 AC 123 ms
55,596 KB
testcase_06 AC 123 ms
55,624 KB
testcase_07 AC 129 ms
55,764 KB
testcase_08 AC 122 ms
55,516 KB
testcase_09 AC 119 ms
55,816 KB
testcase_10 AC 120 ms
55,788 KB
testcase_11 AC 124 ms
55,548 KB
testcase_12 AC 121 ms
55,596 KB
testcase_13 AC 120 ms
55,568 KB
testcase_14 AC 118 ms
55,988 KB
testcase_15 AC 119 ms
55,944 KB
testcase_16 AC 118 ms
55,868 KB
testcase_17 AC 120 ms
54,084 KB
testcase_18 AC 124 ms
55,604 KB
testcase_19 AC 121 ms
55,556 KB
testcase_20 AC 122 ms
55,704 KB
testcase_21 AC 120 ms
55,380 KB
testcase_22 AC 120 ms
55,776 KB
testcase_23 AC 121 ms
56,124 KB
testcase_24 AC 122 ms
55,360 KB
testcase_25 AC 121 ms
55,932 KB
testcase_26 AC 122 ms
55,696 KB
testcase_27 AC 122 ms
55,772 KB
testcase_28 AC 121 ms
55,780 KB
testcase_29 AC 122 ms
55,768 KB
testcase_30 AC 126 ms
55,688 KB
testcase_31 AC 123 ms
55,872 KB
testcase_32 AC 127 ms
55,516 KB
testcase_33 AC 128 ms
55,396 KB
testcase_34 AC 128 ms
55,644 KB
testcase_35 AC 122 ms
55,756 KB
testcase_36 AC 120 ms
55,740 KB
testcase_37 AC 120 ms
56,504 KB
testcase_38 AC 121 ms
55,340 KB
testcase_39 AC 118 ms
55,556 KB
testcase_40 AC 122 ms
55,604 KB
testcase_41 AC 121 ms
55,852 KB
testcase_42 AC 122 ms
55,776 KB
testcase_43 AC 120 ms
55,636 KB
testcase_44 AC 124 ms
56,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no312;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long max = (long) Math.sqrt(n);
		for(long i=3;i<=max;i++) {
			if (n % i == 0) {
				System.out.println(i);
				return;
			}
		}
		if (n % 2 == 0 && n / 2 >= 3) {
			System.out.println(n / 2);
			return;
		}
		System.out.println(n);
	}
}
0