QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501128#5152. Circular Caramel CookiemmzskmWA 0ms3916kbC++14868b2024-08-02 14:37:502024-08-02 14:37:50

Judging History

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

  • [2024-08-02 14:37:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3916kb
  • [2024-08-02 14:37:50]
  • 提交

answer

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<stack>
#include<iomanip>
#include<cmath>
using namespace std;
using ll = long long;
#define int ll


void solve()
{
    int n;
    cin >> n; 
    if (n >= 1 && n <= 4)
    {
        cout << fixed << setprecision(12) << sqrt(2);
        return;
    }
    int k = 4;
    while (true)
    {
        if (n <= k * k - 4 && n > (k - 2) * (k - 2) - 4)
        {
            break;
        }
        k += 2;
    }
    k /= 2;
    cout << fixed << setprecision(12) << sqrt(k * k + (k - 1) * (k - 1));
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int T = 1;
    //cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}




Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2.236067977500

result:

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

Test #2:

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

input:

59

output:

5.000000000000

result:

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

Test #3:

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

input:

1

output:

1.414213562373

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

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

input:

2

output:

1.414213562373

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

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

input:

3

output:

1.414213562373

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

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

input:

4

output:

1.414213562373

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'