提交记录 10107


用户 题目 状态 得分 用时 内存 语言 代码长度
shixiangyu 1000i. 【传统题】 A+B Problem Wrong Answer 0 34.32 us 16 KB C++11 638 B
提交时间 评测时间
2019-08-13 14:05:04 2020-08-01 02:01:46
#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);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #134.32 us16 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-30 04:16:11 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠