結果
問題 |
No.1330 Multiply or Divide
|
ユーザー |
![]() |
提出日時 | 2021-01-08 21:23:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 550 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 199,252 KB |
最終ジャッジ日時 | 2025-01-17 11:08:49 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 WA * 7 |
ソースコード
#include "bits/stdc++.h" using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = (1LL << 61); ll mod = (ll)1e9 + 7; signed main() { ll N, M, P; cin >> N >> M >> P; vector<ll>A(N); for (int i = 0; i < N; i++)cin >> A[i]; sort(A.rbegin(), A.rend()); for (int i = 0; i < N; i++) { if (A[i] > M) { cout << 1 << endl; return 0; } if (A[i] % P != 0) { ll x = 1; ll ans = 0; while (true) { if (x > M)break; ans++; x *= A[i]; } cout << ans << endl; return 0; } } cout << -1 << endl; }