結果
問題 |
No.1330 Multiply or Divide
|
ユーザー |
![]() |
提出日時 | 2021-01-08 21:35:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 1,481 ms |
コンパイル使用メモリ | 164,084 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 10:30:25 |
合計ジャッジ時間 | 5,006 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 WA * 10 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2021.01.08 21:35:28 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,m,p;cin >> n >> m >> p; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; while (a[i] % p == 0) { a[i] /= p; } } sort(a.rbegin(), a.rend()); int ans = 0; ll x = 1; if (a[0] == 1) { cout << -1 << endl; return 0; } while(x < m) { x *= a[0]; ans++; } cout << ans << endl; return 0; }