QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140686#5152. Circular Caramel CookieAnwar_Gehad_Maghraby#WA 4ms3828kbC++23667b2023-08-16 16:53:262023-08-16 16:53:28

Judging History

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

  • [2023-08-16 16:53:28]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3828kb
  • [2023-08-16 16:53:26]
  • 提交

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'