結果
問題 | No.1330 Multiply or Divide |
ユーザー | ks2m |
提出日時 | 2021-01-08 21:49:10 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 900 bytes |
コンパイル時間 | 1,738 ms |
コンパイル使用メモリ | 77,628 KB |
実行使用メモリ | 68,900 KB |
最終ジャッジ日時 | 2024-04-28 03:08:25 |
合計ジャッジ時間 | 10,495 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 298 ms
54,164 KB |
testcase_02 | RE | - |
testcase_03 | AC | 48 ms
36,300 KB |
testcase_04 | AC | 48 ms
36,172 KB |
testcase_05 | AC | 46 ms
36,692 KB |
testcase_06 | AC | 218 ms
54,324 KB |
testcase_07 | WA | - |
testcase_08 | AC | 279 ms
57,812 KB |
testcase_09 | AC | 290 ms
57,216 KB |
testcase_10 | AC | 279 ms
56,892 KB |
testcase_11 | AC | 270 ms
57,472 KB |
testcase_12 | AC | 270 ms
57,092 KB |
testcase_13 | AC | 50 ms
36,800 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 48 ms
36,936 KB |
testcase_17 | WA | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 277 ms
58,336 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 50 ms
36,640 KB |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | AC | 48 ms
36,624 KB |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int m = Integer.parseInt(sa[1]); int p = Integer.parseInt(sa[2]); sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); for (int i = 0; i < n; i++) { if (a[i] > m) { throw new Exception(); } while (a[i] % p == 0) { a[i] /= p; } } int max = 0; for (int i = 0; i < n; i++) { max = Math.max(max, a[i]); } if (max <= 1) { System.out.println(-1); } else { long x = 1; int ans = 0; while (x <= m) { ans++; x *= max; } System.out.println(ans); } } }