20分求助
查看原帖
20分求助
1311134
Yae__Miko楼主2024/11/23 20:49
#include<bits/stdc++.h>
#define endl "\n"
#define IO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=1e6+10;
int n,nextday=-1,times[maxn];
int main()
{
	IO;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>times[i];
		nextday=max(nextday,times[i]);
	}
	int save=nextday;
	sort(times+1,times+1+n);
	for(int i=1;i<=n;i++){
		bool flag=false;
		while(flag==false){
			if(nextday%times[i]!=0||nextday%save!=0){
				nextday++;
			}
			else flag=true;
		}
	}
	cout<<nextday;
	return 0;
}

2024/11/23 20:49
加载中...