結果

問題 No.1113 二つの整数 / Two Integers
ユーザー ks2m
提出日時 2020-07-17 21:22:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 493 bytes
コンパイル時間 3,008 ms
コンパイル使用メモリ 75,432 KB
実行使用メモリ 41,676 KB
最終ジャッジ日時 2024-11-30 06:21:09
合計ジャッジ時間 6,169 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		sc.close();

		long g = gcd(a, b);
		long s = (long) Math.sqrt(g) - 10;
		for (long i = s; i < s + 20; i++) {
			if (i * i == g) {
				System.out.println("Odd");
				return;
			}
		}
		System.out.println("Even");
	}

	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}
0