結果

問題 No.1224 I hate Sqrt Inequality
ユーザー tenten
提出日時 2020-09-12 10:02:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 74,092 KB
実行使用メモリ 41,528 KB
最終ジャッジ日時 2024-06-11 21:22:29
合計ジャッジ時間 4,729 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long a = sc.nextLong();
    	long b = sc.nextLong();
    	b /= getGCD(a, b);
    	while (b % 2 == 0) {
    	    b /= 2;
    	}
    	while (b % 5 == 0) {
    	    b /= 5;
    	}
    	if (b > 1) {
    	    System.out.println("Yes");
    	} else {
    	    System.out.println("No");
    	}
	}
	
	static long getGCD(long a, long b) {
	    if (a % b == 0) {
	        return b;
	    } else {
	        return getGCD(b, a % b);
	    }
	}
}
0