QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#154114 | #5152. Circular Caramel Cookie | acm202226010311 | WA | 1ms | 3588kb | C++14 | 820b | 2023-08-31 13:46:09 | 2023-08-31 13:46:10 |
Judging History
answer
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;
int num(int a)//a代表r*r
{
int res=0;
for(int i=int(sqrt(a));i>0;i--)
res+=int(sqrt(a-i*i));
res*=4;
return res;
}
int main()
{
int n;
cin>>n;
if(n<=3)
{
cout<<fixed<<setprecision(10)<<sqrt(2)<<endl;
return 0;
}
if(n>=4&&n<=7)
{
cout<<fixed<<setprecision(10)<<sqrt(5)<<endl;
return 0;
}
n++;
int r=sqrt(n);
int l=r/3;
int mid;
while(l<r)
{
mid=(l+r)/2;
int t=num(mid*mid);
if(t>=n)r=mid;
if(t<=n)l=mid;
cout<<"l"<<l<<" "<<"r"<<r<<endl;
if(l+1==r)break;
}
mid=(l+r)/2;
int b=mid*mid;
int e=(mid+1)*(mid+1);
for(int i=b;i<=e;i++)
{
if(num(i)>=n)
{
cout<<fixed<<setprecision(10)<<sqrt(i);
break;
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3588kb
input:
11
output:
l2 r3 2.2360679775
result:
wrong output format Expected double, but "l2" found