QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501143#5152. Circular Caramel CookiemmzskmWA 0ms3920kbC++14971b2024-08-02 14:47:262024-08-02 14:47:26

Judging History

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

  • [2024-08-02 14:47:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3920kb
  • [2024-08-02 14:47:26]
  • 提交

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 <= 3)
    {
        cout << fixed << setprecision(12) << sqrt(2);
        return;
    }
    if (n == 4)
    {
        cout << fixed << setprecision(12) << sqrt(5);
        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: 3744kb

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: 3804kb

input:

1

output:

1.414213562373

result:

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

Test #4:

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

input:

2

output:

1.414213562373

result:

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

Test #5:

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

input:

3

output:

1.414213562373

result:

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

Test #6:

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

input:

4

output:

2.236067977500

result:

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

Test #7:

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

input:

1000000000

output:

22360.837752642452

result:

wrong answer 1st numbers differ - expected: '17841.8813190', found: '22360.8377526', error = '0.2532780'