結果

問題 No.136 Yet Another GCD Problem
ユーザー k_kadora
提出日時 2015-06-16 21:42:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 3,557 ms
コンパイル使用メモリ 76,804 KB
実行使用メモリ 54,608 KB
最終ジャッジ日時 2024-07-07 03:21:07
合計ジャッジ時間 9,641 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yuki136{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,k,res=1;
		n = sc.nextInt();
		k = sc.nextInt();
		if(n % 2 == 0){
			res = n /2;
		}else{
			for(int i = 3;i < n ;i++){
				if(n % i == 0){
					res = n /i;
					break;
				}
			}
		}
		System.out.println(res);
	}
}
0