Compile Error
foo.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
Code
#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=2000000007;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
cin>>t;
while(t--){
map<int,int>one,two,three;
ll x;
set<int>st;
vector<int>v;
one[1]++;
two[1]++;
three[1]++;
for(int i=1;i<=3;i++){
int a;
cin>>a;
v.push_back(a);
}
cin>>x;
int cur=1;
for(int i:v){
ll d=i;
for(ll j=2;j*j<=d;j++){
if(d%j==0){
st.insert(j);
while(d%j==0 && d>1){
d/=j;
if(cur==1)one[j]++;
if(cur==2)two[j]++;
if(cur==3)three[j]++;
}
}
}
if(d>1){
st.insert(d);
if(cur==1)one[d]++;
if(cur==2)two[d]++;
if(cur==3)three[d]++;
}
cur++;
}
ll res=1;
for(auto it:st){
ll i=it;
int mx=max({one[it],two[it],three[it]});
while(mx>0){
if(res*i>=x){
res=-1;
break;
}
res*=i;
mx--;
}
if(res==-1)break;
}
cout<<res<<"\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1025 GCM
- Contest
- Brain booster #2
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2024-03-06 16:39:23
- Judged At
- 2024-11-11 03:41:16
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes