結果
問題 |
No.1330 Multiply or Divide
|
ユーザー |
![]() |
提出日時 | 2021-01-08 21:28:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,212 bytes |
コンパイル時間 | 1,623 ms |
コンパイル使用メモリ | 172,572 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 10:11:58 |
合計ジャッジ時間 | 3,967 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(s) (s).begin(),(s).end() #define vcin(n) for(ll i=0;i<ll(n.size());i++) cin>>n[i] #define rever(vec) reverse(vec.begin(), vec.end()) #define sor(vec) sort(vec.begin(), vec.end()) #define fi first #define se second //const ll mod = 998244353; const ll mod = 1000000007; const ll inf = 2000000000000000000ll; static const long double pi = 3.141592653589793; template<class T,class U> void chmax(T& t,const U& u){if(t<u) t=u;} template<class T,class U> void chmin(T& t,const U& u){if(t>u) t=u;} ll modPow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; } int main() { /* mod は 1e9+7 */ ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(10); ll a,b,c; cin>>a>>b>>c; vector<ll> n(a); vcin(n); bool tmp=true; for(int i=0;i<a;i++){ while(n[i]%c==0){ n[i]/=c; } if(n[i]!=1){ tmp=false; } } if(tmp){ cout<<-1<<endl; return 0; } ll z=1; sor(n); rever(n); ll ans=0; while(z<b){ z*=n[0]; ans++; } cout<<ans<<endl; }