結果

問題 No.1224 I hate Sqrt Inequality
ユーザー tentententen
提出日時 2022-09-16 13:47:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 1,484 bytes
コンパイル時間 2,626 ms
コンパイル使用メモリ 77,928 KB
実行使用メモリ 50,324 KB
最終ジャッジ日時 2024-06-01 05:53:33
合計ジャッジ時間 4,196 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
49,980 KB
testcase_01 AC 58 ms
50,252 KB
testcase_02 AC 56 ms
50,280 KB
testcase_03 AC 56 ms
50,000 KB
testcase_04 AC 55 ms
50,000 KB
testcase_05 AC 57 ms
49,868 KB
testcase_06 AC 57 ms
49,976 KB
testcase_07 AC 57 ms
49,868 KB
testcase_08 AC 56 ms
50,152 KB
testcase_09 AC 56 ms
50,324 KB
testcase_10 AC 55 ms
50,040 KB
testcase_11 AC 56 ms
49,876 KB
testcase_12 AC 56 ms
50,272 KB
testcase_13 AC 58 ms
49,924 KB
testcase_14 AC 56 ms
50,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long n = sc.nextLong();
        long m = sc.nextLong();
        long gcd = getGCD(n , m);
        n /= gcd;
        m /= gcd;
        while (m % 2 == 0) {
            m /= 2;
        }
        while (m % 5 == 0) {
            m /= 5;
        }
        if (m == 1) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
    
    static long getGCD(long x, long y) {
        if (y == 0) {
            return x;
        } else {
            return getGCD(y, x % y);
        }
    }

}
    
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0