提交记录 10103
| 提交时间 |
评测时间 |
| 2019-08-13 14:00:55 |
2020-08-01 02:01:13 |
#include<cstdio>
#include<cmath>
#include<ctime>
#include<cstdlib>
int n,m,bx,by,best,ans;
inline int calc(int a,int b){
return n+m-a-b;
}
inline void SA(){
int x0=m,y2=n,y3,x1=0,res=0;
for (double T=2000;T>1e-14;T*=0.977777777777777){
x1=x0+T*(rand()*2-RAND_MAX);
y3=y2+T*(rand()*2-RAND_MAX);
res=abs(calc(x1,y3));
if(best>=res) bx=x1,by=y3;
if(ans>=res||exp((ans-res)/T)>(long double)(rand())/RAND_MAX) ans=res,x0=x1,y2=y3;
}
}
int main(){
srand(time(NULL));
scanf("%d%d",&n,&m);
ans=best=calc(n,m);
for (register int i=0;i<1;++i) SA();
printf("%d",bx+by);
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-30 04:18:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠