QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#140686 | #5152. Circular Caramel Cookie | Anwar_Gehad_Maghraby# | WA | 4ms | 3828kb | C++23 | 667b | 2023-08-16 16:53:26 | 2023-08-16 16:53:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long calc(double r){
int x = r;
long long ans = 0;
for(int y = 1; y <= r; y++){
while(1LL * x * x + 1LL * y * y > 1LL * r * r)
--x;
ans += x;
}
return 4 * ans;
}
int main() {
cin.tie(0);cin.sync_with_stdio(0);
cout.tie(0);cout.sync_with_stdio(0);
int s; cin>>s;
double L = 0, R= 1e6 + 10, ans;
for(int rep = 0; rep < 120; rep++){
double md = (L + R) * 0.5;
if(calc(md) >= s)
ans= md, R= md;
else
L= md;
}
cout<<fixed<<setprecision(10);
cout<<ans<<"\n";
}
詳細信息
Test #1:
score: 100
Accepted
time: 4ms
memory: 3656kb
input:
11
output:
2.2360679775
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 4ms
memory: 3728kb
input:
59
output:
5.0000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
1
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
2
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 4ms
memory: 3812kb
input:
3
output:
1.4142135624
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 4ms
memory: 3828kb
input:
4
output:
1.4142135624
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'