結果
問題 | No.1330 Multiply or Divide |
ユーザー |
![]() |
提出日時 | 2021-01-08 21:31:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 1,540 ms |
コンパイル使用メモリ | 166,812 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-16 10:21:15 |
合計ジャッジ時間 | 4,321 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 WA * 8 |
ソースコード
#include<bits/stdc++.h> // #include<atcoder/all> using namespace std; // using namespace atcoder; using ll = long long; using ull = unsigned long long; using P = pair<int,int>; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define MOD 1000000007 int main(){ ll n,m,p; cin >> n >> m >> p; ll k = 0; rep(i,n){ ll x;cin >> x; while(x%p == 0)x /= p; k = max(k,x); } if(k == 1)cout << -1 << "\n"; else { int res = 0; ll g = 1; while(g <= m)g *= k,res++; cout << res << "\n"; } return 0; }