QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501187#5152. Circular Caramel CookiessmyWA 0ms3924kbC++20897b2024-08-02 15:29:402024-08-02 15:29:40

Judging History

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

  • [2024-08-02 15:29:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3924kb
  • [2024-08-02 15:29:40]
  • 提交

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;
    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;
}

详细

Test #1:

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

input:

11

output:

2.236067977

result:

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

Test #2:

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

input:

59

output:

5

result:

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

Test #3:

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

input:

1

output:

1.414213562

result:

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

Test #4:

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

input:

2

output:

1.414213562

result:

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

Test #5:

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

input:

3

output:

1.414213562

result:

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

Test #6:

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

input:

4

output:

2.236067977

result:

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

Test #7:

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

input:

1000000000

output:

22360.13065

result:

wrong answer 1st numbers differ - expected: '17841.8813190', found: '22360.1306500', error = '0.2532384'