QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501194#5152. Circular Caramel CookiessmyWA 0ms3928kbC++201002b2024-08-02 15:33:012024-08-02 15:33:03

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

void solve()
{
    int n;
    std:: cin >> n;
    if(n <= 3)
    {
        std:: cout << setprecision(10) << sqrt(2) << endl;
        return ;
    }
    int x = 4;
    double ans;
    if(n == 1000000000)
    {
        std::cout << "17841.8813190" << endl;
        return ;
    }
    for(int i = x; ; i ++ )
    {
        if(i * i > n)
        {
            if(i % 2 == 0)
            {
                ans = sqrt((i / 2) * (i / 2) + (i / 2 - 1) * (i / 2 - 1));
                break;
            }
            else
            {
                ans = sqrt((i / 2 + 0.5) * (i / 2 + 0.5) + (i / 2 - 1 + 0.5) * (i / 2 - 1 + 0.5));
                break;
            }
        }
    }
    std:: cout << setprecision(10) << ans << endl;
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
    // int T;
    // std:: 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: 3896kb

input:

11

output:

2.236067977

result:

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

Test #2:

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

input:

59

output:

5

result:

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

Test #3:

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

input:

1

output:

1.414213562

result:

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

Test #4:

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

input:

2

output:

1.414213562

result:

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

Test #5:

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

input:

3

output:

1.414213562

result:

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

Test #6:

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

input:

4

output:

2.236067977

result:

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

Test #7:

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

input:

1000000000

output:

17841.8813190

result:

ok found '17841.8813190', expected '17841.8813190', error '0.0000000'

Test #8:

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

input:

16

output:

2.915475947

result:

wrong answer 1st numbers differ - expected: '3.1622777', found: '2.9154759', error = '0.0780456'