結果

問題 No.136 Yet Another GCD Problem
ユーザー spaciaspacia
提出日時 2016-01-20 12:27:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 74,576 KB
実行使用メモリ 53,572 KB
最終ジャッジ日時 2023-10-21 13:29:45
合計ジャッジ時間 6,061 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
53,568 KB
testcase_01 AC 56 ms
53,560 KB
testcase_02 AC 54 ms
53,548 KB
testcase_03 AC 55 ms
53,564 KB
testcase_04 AC 54 ms
53,556 KB
testcase_05 AC 54 ms
53,552 KB
testcase_06 AC 53 ms
51,508 KB
testcase_07 AC 53 ms
53,504 KB
testcase_08 AC 54 ms
53,556 KB
testcase_09 AC 53 ms
51,520 KB
testcase_10 AC 53 ms
53,556 KB
testcase_11 AC 52 ms
53,556 KB
testcase_12 AC 53 ms
53,560 KB
testcase_13 AC 53 ms
53,572 KB
testcase_14 AC 53 ms
53,556 KB
testcase_15 AC 53 ms
53,564 KB
testcase_16 AC 53 ms
53,552 KB
testcase_17 AC 54 ms
53,512 KB
testcase_18 AC 53 ms
53,556 KB
testcase_19 AC 54 ms
53,548 KB
testcase_20 AC 52 ms
53,556 KB
testcase_21 AC 53 ms
52,444 KB
testcase_22 AC 54 ms
53,556 KB
testcase_23 AC 54 ms
53,564 KB
testcase_24 AC 53 ms
53,556 KB
testcase_25 AC 52 ms
53,548 KB
testcase_26 AC 52 ms
53,556 KB
testcase_27 AC 52 ms
53,564 KB
testcase_28 AC 53 ms
53,552 KB
testcase_29 AC 54 ms
53,556 KB
testcase_30 AC 53 ms
53,564 KB
testcase_31 AC 55 ms
53,552 KB
testcase_32 AC 54 ms
53,552 KB
testcase_33 AC 53 ms
53,548 KB
testcase_34 AC 53 ms
53,556 KB
testcase_35 AC 55 ms
53,564 KB
testcase_36 AC 53 ms
53,560 KB
testcase_37 AC 53 ms
53,556 KB
testcase_38 AC 53 ms
53,552 KB
testcase_39 AC 53 ms
53,556 KB
testcase_40 AC 54 ms
52,456 KB
testcase_41 AC 55 ms
53,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (int n) {
		if (n % 2 == 0) return n / 2;
		for (int i = 3; i * i <= n; i += 2)
			if (n % i == 0) return n / i;
		return 1;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		
		out(solve(Integer.parseInt(line[0])));
	}
}
0