标签:++ false logs oid while scanf als 模拟退火 amp
#include <bits/stdc++.h>
using namespace std;
int a[10000],now,best;
double T=9999;
bool solve(){
int p=rand()*rand()%10000;
if(a[now+1]>a[now]){
now=now+1;
if(a[best]<a[now])
best=now;
}
else {
if(T>p){
now=now+1;
T*=0.99;
}
else
return false;
}
return true;
}
void sa(){
for(int iii=1;iii<=50;iii++){
T=9999;
now=best;
while(T>=100)
if(!solve())break;
}
}
int main(){
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
now=1;
sa();
printf("%d",a[best]);
return 0;
}
标签:++ false logs oid while scanf als 模拟退火 amp
原文地址:http://www.cnblogs.com/HC-LittleJian/p/7629998.html