結果

問題 No.136 Yet Another GCD Problem
ユーザー YamaKasaYamaKasa
提出日時 2018-07-17 17:57:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 371 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 71,524 KB
実行使用メモリ 56,020 KB
最終ジャッジ日時 2023-08-17 02:52:34
合計ジャッジ時間 9,210 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,796 KB
testcase_01 AC 123 ms
55,776 KB
testcase_02 AC 122 ms
55,496 KB
testcase_03 AC 123 ms
55,760 KB
testcase_04 AC 125 ms
55,836 KB
testcase_05 AC 123 ms
53,884 KB
testcase_06 AC 124 ms
55,680 KB
testcase_07 AC 129 ms
56,016 KB
testcase_08 AC 124 ms
55,772 KB
testcase_09 AC 125 ms
55,568 KB
testcase_10 AC 126 ms
55,988 KB
testcase_11 AC 126 ms
55,828 KB
testcase_12 AC 124 ms
55,820 KB
testcase_13 AC 122 ms
55,720 KB
testcase_14 AC 123 ms
56,020 KB
testcase_15 AC 124 ms
55,748 KB
testcase_16 AC 129 ms
55,812 KB
testcase_17 AC 123 ms
55,460 KB
testcase_18 AC 122 ms
55,868 KB
testcase_19 AC 124 ms
55,580 KB
testcase_20 AC 128 ms
55,856 KB
testcase_21 AC 122 ms
55,908 KB
testcase_22 AC 123 ms
55,676 KB
testcase_23 AC 122 ms
55,696 KB
testcase_24 AC 124 ms
55,948 KB
testcase_25 AC 123 ms
55,960 KB
testcase_26 AC 123 ms
55,528 KB
testcase_27 AC 125 ms
55,936 KB
testcase_28 AC 123 ms
55,832 KB
testcase_29 AC 123 ms
55,584 KB
testcase_30 AC 123 ms
55,800 KB
testcase_31 AC 124 ms
55,460 KB
testcase_32 AC 123 ms
55,724 KB
testcase_33 AC 127 ms
55,800 KB
testcase_34 AC 123 ms
55,832 KB
testcase_35 AC 123 ms
55,920 KB
testcase_36 AC 122 ms
56,000 KB
testcase_37 AC 123 ms
55,704 KB
testcase_38 AC 123 ms
55,580 KB
testcase_39 AC 122 ms
55,552 KB
testcase_40 AC 121 ms
55,812 KB
testcase_41 AC 126 ms
55,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		scan.close();
		if(K == 1) {
			System.exit(0);
		}
		int ans = 1;
		for(int i = N - 1; i >= 2; i--) {
			if(N % i == 0) {
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
}
0