细胞分裂
作者:
jy9
,
2024-09-07 16:29:27
,
所有人可见
,
阅读 4
#include <iostream>
#include <unordered_map>
using namespace std;
typedef unordered_map<int, int> um;
um fenjie(int num){
um fenjie;
for (int i = 2; i <= num / i; i ++ ){
while(num%i == 0){
num /= i;
fenjie[i] ++;
}
}
if(num > 1) fenjie[num] = 1;
return fenjie;
}
int main(){
int n, m1, m2;
cin >> n >> m1 >> m2;
um shiguan = fenjie(m1);
int inf = 2e9;
int ans = 2e9;
for (int i = 1; i <= n; i ++ ){
int cell;
int t = 0;
cin >> cell;
um cf = fenjie(cell);
for(auto [u,v]:shiguan){
if(cf[u] == 0){
t = inf;
break;
}
else{
t = max(t, (v*m2+cf[u]-1)/cf[u]);
}
}
ans = min(t, ans);
}
if(ans == inf)cout << -1;
else cout << ans;
return 0;
}
#include [HTML_REMOVED]
#include [HTML_REMOVED]
using namespace std;
typedef unordered_map[HTML_REMOVED] um;
um fenjie(int num){
um fenjie;
for (int i = 2; i <= num / i; i ){
while(num%i == 0){
num /= i;
fenjie[i] ;
}
}
if(num > 1) fenjie[num] = 1;
}
int main(){
int n, m1, m2;
cin >> n >> m1 >> m2;
um shiguan = fenjie(m1);
int inf = 2e9;
int ans = 2e9;
}