結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー | tenten |
提出日時 | 2023-02-22 13:04:46 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 2,264 bytes |
コンパイル時間 | 3,056 ms |
コンパイル使用メモリ | 85,100 KB |
実行使用メモリ | 39,880 KB |
最終ジャッジ日時 | 2024-07-22 15:04:07 |
合計ジャッジ時間 | 7,619 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
36,976 KB |
testcase_01 | AC | 50 ms
37,096 KB |
testcase_02 | AC | 51 ms
37,072 KB |
testcase_03 | AC | 50 ms
36,596 KB |
testcase_04 | AC | 71 ms
38,132 KB |
testcase_05 | AC | 60 ms
37,328 KB |
testcase_06 | AC | 51 ms
37,220 KB |
testcase_07 | AC | 49 ms
37,108 KB |
testcase_08 | AC | 59 ms
37,376 KB |
testcase_09 | AC | 50 ms
37,280 KB |
testcase_10 | AC | 71 ms
37,604 KB |
testcase_11 | AC | 50 ms
37,276 KB |
testcase_12 | AC | 50 ms
36,536 KB |
testcase_13 | AC | 50 ms
37,100 KB |
testcase_14 | AC | 51 ms
36,736 KB |
testcase_15 | AC | 81 ms
38,692 KB |
testcase_16 | AC | 62 ms
38,556 KB |
testcase_17 | AC | 85 ms
38,692 KB |
testcase_18 | AC | 86 ms
38,204 KB |
testcase_19 | AC | 75 ms
38,016 KB |
testcase_20 | AC | 57 ms
37,072 KB |
testcase_21 | AC | 87 ms
38,456 KB |
testcase_22 | AC | 59 ms
37,124 KB |
testcase_23 | AC | 71 ms
37,332 KB |
testcase_24 | AC | 54 ms
37,164 KB |
testcase_25 | AC | 88 ms
38,784 KB |
testcase_26 | AC | 56 ms
37,168 KB |
testcase_27 | AC | 49 ms
37,240 KB |
testcase_28 | AC | 93 ms
39,044 KB |
testcase_29 | AC | 88 ms
38,004 KB |
testcase_30 | AC | 92 ms
39,880 KB |
testcase_31 | AC | 81 ms
38,644 KB |
testcase_32 | AC | 54 ms
36,620 KB |
testcase_33 | AC | 53 ms
36,716 KB |
testcase_34 | AC | 52 ms
36,936 KB |
testcase_35 | AC | 49 ms
36,992 KB |
testcase_36 | AC | 89 ms
38,600 KB |
testcase_37 | AC | 48 ms
37,120 KB |
testcase_38 | AC | 50 ms
37,024 KB |
testcase_39 | AC | 50 ms
37,240 KB |
testcase_40 | AC | 49 ms
36,864 KB |
testcase_41 | AC | 48 ms
37,168 KB |
testcase_42 | AC | 49 ms
37,136 KB |
testcase_43 | AC | 48 ms
36,932 KB |
testcase_44 | AC | 48 ms
37,100 KB |
testcase_45 | AC | 48 ms
36,920 KB |
testcase_46 | AC | 47 ms
37,192 KB |
testcase_47 | AC | 49 ms
36,688 KB |
testcase_48 | AC | 47 ms
37,156 KB |
testcase_49 | AC | 47 ms
37,100 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); HashMap<Long, Integer> xCount = getMap(sc.nextLong()); long a = sc.nextLong(); HashMap<Long, Integer> yCount = getMap(sc.nextLong()); long b = sc.nextLong(); for (long z : yCount.keySet()) { if (yCount.get(z) * b > xCount.getOrDefault(z, 0) * a) { System.out.println("No"); return; } } System.out.println("Yes"); } static HashMap<Long, Integer> getMap(long x) { HashMap<Long, Integer> counts = new HashMap<>(); for (long i = 2; i <= Math.sqrt(x); i++) { while (x % i == 0) { counts.put(i, counts.getOrDefault(i, 0) + 1); x /= i; } } if (x > 1) { counts.put(x, counts.getOrDefault(x, 0) + 1); } return counts; } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } 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 int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }