結果

問題 No.136 Yet Another GCD Problem
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-02 16:29:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 594 bytes
コンパイル時間 1,958 ms
コンパイル使用メモリ 71,900 KB
実行使用メモリ 58,040 KB
最終ジャッジ日時 2023-08-18 12:18:16
合計ジャッジ時間 8,822 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
56,084 KB
testcase_01 AC 112 ms
56,196 KB
testcase_02 AC 119 ms
55,724 KB
testcase_03 AC 114 ms
55,764 KB
testcase_04 AC 113 ms
56,060 KB
testcase_05 AC 109 ms
55,728 KB
testcase_06 AC 111 ms
56,084 KB
testcase_07 AC 112 ms
55,732 KB
testcase_08 AC 110 ms
56,116 KB
testcase_09 AC 115 ms
55,464 KB
testcase_10 AC 108 ms
55,732 KB
testcase_11 AC 113 ms
56,124 KB
testcase_12 AC 112 ms
55,744 KB
testcase_13 AC 114 ms
55,844 KB
testcase_14 AC 113 ms
56,192 KB
testcase_15 AC 116 ms
56,084 KB
testcase_16 AC 115 ms
55,752 KB
testcase_17 AC 112 ms
55,788 KB
testcase_18 AC 114 ms
56,088 KB
testcase_19 AC 111 ms
55,736 KB
testcase_20 AC 111 ms
55,920 KB
testcase_21 AC 113 ms
55,732 KB
testcase_22 AC 112 ms
58,040 KB
testcase_23 AC 113 ms
55,856 KB
testcase_24 AC 112 ms
56,164 KB
testcase_25 AC 112 ms
53,684 KB
testcase_26 AC 114 ms
54,240 KB
testcase_27 AC 112 ms
55,996 KB
testcase_28 AC 111 ms
56,320 KB
testcase_29 AC 114 ms
55,912 KB
testcase_30 AC 112 ms
56,164 KB
testcase_31 AC 119 ms
56,332 KB
testcase_32 AC 112 ms
55,660 KB
testcase_33 AC 115 ms
56,128 KB
testcase_34 AC 112 ms
56,104 KB
testcase_35 AC 114 ms
56,440 KB
testcase_36 AC 109 ms
53,832 KB
testcase_37 AC 113 ms
55,788 KB
testcase_38 AC 115 ms
56,100 KB
testcase_39 AC 112 ms
55,884 KB
testcase_40 AC 115 ms
56,656 KB
testcase_41 AC 115 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans=divid(N);
        System.out.println(ans);
    }
    static int divid(int x){
        if(x%2==0){
            return x/2;
        }else{
            int z=1;
            int rt=(int)Math.sqrt(x);
            for(int i=3;i<=rt; i+=2){
                if(x%i==0){
                    z=x/i;
                    break;
                }
            }
            return z;
        }
    }
}
0