結果

問題 No.1224 I hate Sqrt Inequality
ユーザー tentententen
提出日時 2020-09-12 10:02:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 2,337 ms
コンパイル使用メモリ 71,932 KB
実行使用メモリ 56,552 KB
最終ジャッジ日時 2023-09-02 14:48:20
合計ジャッジ時間 4,800 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,700 KB
testcase_01 AC 121 ms
55,724 KB
testcase_02 AC 119 ms
55,532 KB
testcase_03 AC 117 ms
55,740 KB
testcase_04 AC 114 ms
56,552 KB
testcase_05 AC 114 ms
55,604 KB
testcase_06 AC 115 ms
55,800 KB
testcase_07 AC 119 ms
55,788 KB
testcase_08 AC 119 ms
55,804 KB
testcase_09 AC 115 ms
55,744 KB
testcase_10 AC 119 ms
55,720 KB
testcase_11 AC 118 ms
55,688 KB
testcase_12 AC 118 ms
55,656 KB
testcase_13 AC 121 ms
55,836 KB
testcase_14 AC 124 ms
55,692 KB
権限があれば一括ダウンロードができます

ソースコード

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