結果
問題 | No.1330 Multiply or Divide |
ユーザー |
|
提出日時 | 2021-01-08 23:18:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 796 bytes |
コンパイル時間 | 2,115 ms |
コンパイル使用メモリ | 200,304 KB |
最終ジャッジ日時 | 2025-01-17 14:31:18 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 WA * 17 |
ソースコード
/** * author: shu8Cream * created: 08.01.2021 21:06:40 **/ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n,m,p; cin >> n >> m >> p; vector<P> a(n); rep(i,n){ cin >> a[i].first; while(a[i].first%p==0){ a[i].first/=p; a[i].second++; } } sort(all(a)); int tmp = 1; int ans = 0; if(a[n-1].first==1){ cout << -1 << endl; return 0; } while(tmp<m){ tmp*=a[n-1].first; ans+=a[n-1].second+1; } cout << ans << endl; }