結果
| 問題 | 
                            No.1723 [Cherry 3rd Tune *] Dead on
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ks2m
                         | 
                    
| 提出日時 | 2021-10-29 21:30:12 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 166 ms / 2,000 ms | 
| コード長 | 1,012 bytes | 
| コンパイル時間 | 3,259 ms | 
| コンパイル使用メモリ | 78,704 KB | 
| 実行使用メモリ | 41,924 KB | 
| 最終ジャッジ日時 | 2024-10-07 10:03:47 | 
| 合計ジャッジ時間 | 10,674 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 50 | 
ソースコード
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long a = sc.nextLong();
		long y = sc.nextLong();
		long b = sc.nextLong();
		sc.close();
		Map<Long, Integer> mx = bunkai(x);
		Map<Long, Integer> my = bunkai(y);
		for (long k : my.keySet()) {
			if (!mx.containsKey(k)) {
				System.out.println("No");
				return;
			}
			long vx = mx.get(k) * a;
			long vy = my.get(k) * b;
			if (vx < vy) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
	static Map<Long, Integer> bunkai(long n) {
		Map<Long, Integer> soinsu = new HashMap<>();
		int end = (int) Math.sqrt(n);
		long d = 2;
		while (n > 1) {
			if (n % d == 0) {
				n /= d;
				soinsu.put(d, soinsu.getOrDefault(d, 0) + 1);
				end = (int) Math.sqrt(n);
			} else {
				if (d > end) {
					d = n - 1;
				}
				d++;
			}
		}
		return soinsu;
	}
}
            
            
            
        
            
ks2m