QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#154104#5152. Circular Caramel Cookieacm202226010311WA 2ms3624kbC++14654b2023-08-31 13:40:012023-08-31 13:40:02

Judging History

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

  • [2023-08-31 13:40:02]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3624kb
  • [2023-08-31 13:40:01]
  • 提交

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;
	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: 100
Accepted
time: 2ms
memory: 3580kb

input:

11

output:

2.2360679775

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

59

output:

5.0000000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3480kb

input:

1

output:


result:

wrong output format Unexpected end of file - double expected