QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501221#5152. Circular Caramel CookieAbclWA 0ms3952kbC++14736b2024-08-02 15:47:332024-08-02 15:47:34

Judging History

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

  • [2024-08-02 15:47:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3952kb
  • [2024-08-02 15:47:33]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
const double hu=3.14159265358*10/4.0;
int n;
double ans;
void solve(){
	cin>>n;
	int k=0;
	double a,b;

	for(int i=sqrt(1e9) ;i>=0;i--){
		if( pow(i,2) <=n ){
			k=i;
			break;
		}
	}
//	cout<<k<<endl;
	if(k*k==n){
		a=k,b=k;
	}
	else if((k+1)*(k+1)-4>=n){
		k++;a=k,b=k-2;
	}
	else {
		a=k+1,b=k+1;
	}
//	cout<<a<<" "<<b<<endl;
	ans=sqrt(a*a+b*b)/2.0;
	printf("%.10lf",ans);
	return;
}
signed main() {
//	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int T_case=1;
//	cin>>T_case;
	while(T_case--){
		solve();
	}
    return 0;
}


详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3952kb

input:

11

output:

2.2360679775

result:

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

Test #2:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

59

output:

5.0000000000

result:

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

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3752kb

input:

1

output:

0.7071067812

result:

wrong answer 1st numbers differ - expected: '1.4142136', found: '0.7071068', error = '0.5000000'