#include <bits/stdc++.h>
using namespace std;
int a[10005] , ans , n;
bool f[10005];
inline void qwe ()
{
double t = 100000;
while (t > 0.00000001)
{
int i = rand () % n + 1;
if (f[i]) continue;
if (a[i] > ans) ans = a[i] , f[i] = 1;
t *= 0.985;
}
}
signed main ()
{
srand (time (0));
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
qwe ();
cout << ans;
return 0;
}
序列中求最大值
另 : 有什么好的网页学模拟退火?找了几个,看不懂