我才90分,请求各位大神赐教
查看原帖
我才90分,请求各位大神赐教
1285330
lanyeyao0308楼主2024/12/9 17:18

我才90分,最后一个样例超时,请求帮助。

代码如下:

#include <bits/stdc++.h>
using namespace std;

int a[1000000];

int main()
{
	int n;
	cin >> n;
	int tmp = 0;
	int i = 0;
	for (int i = 1; i <= n; i++) cin >> a[i];
	while (true)
	{
		tmp = 0;
		i++;
		for (int j = 1; j <= n; j++)
		{
			if (i % a[j] != 0)
			{
				tmp = 1;
				continue;
			}
		}
		if (tmp == 0)
		{
			cout << i << endl;
			return 0;
		}
	}
}

谢谢大家!Thanks♪(・ω・)ノ

2024/12/9 17:18
加载中...