QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501207#5152. Circular Caramel Cookie1DemonS1Compile Error//C++201.0kb2024-08-02 15:39:452024-08-02 15:39:51

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 15:39:51]
  • 评测
  • [2024-08-02 15:39:45]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 9;
const int mod = 1e9 + 7;
const double eps = 1e-9; 
#define inf 2e18

ll ans;
double d=sqrt(2);


bool check(double x)
{
    ll res=0,now=0;
    ll st = x/d;
    res += st * st;

    if(res * 4 >= ans) return false;

    ll nx = st + 1, ny = st;
    //find_now
    while(nx <= x)
    {
        ll l = 0, r = sqrt(x * x - nx * nx) + 10;
        while (l < r)
        {
            //cout<<l<<' '<<r<<'\n';
            ll mid = (l + r)/2 + 1;
            if (nx * nx + mid * mid <= x * x) l = mid;  
            else r = mid - 1;
        }
        now += l;
        nx++;
    }

    now *= 2;
    res += now;
    res *= 4;
    if(res > ans) return false;
    return true;
}   


void solve()
{
    cin>>ans;
    ans ++;
    double l=1, r=1e9 + 100, mid;
    while(fabs(l-r)>=eps)
    {
        mid = (l+r)/2;
        if(check(mid))  l = mid;
        else  r = mid;
    }
    printf("%.10lf",mid);

}

Details

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status