QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96450#5152. Circular Caramel CookieRoomGamadan#WA 2ms3748kbC++201.4kb2023-04-13 21:37:222023-04-13 21:37:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 21:37:36]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3748kb
  • [2023-04-13 21:37:22]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")

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

#define el '\n'
#define F first
#define S second

typedef long long ll;
typedef long double ld;

bool multipleTestCases = 0, sublime = 0;
const int N = 4e5 + 5, INF = 1e9 + 5, mod = 1e9 + 7, LOG = 22, SQ = 500;



void doWork() {
    ll n;
    cin >> n;
    ll s = 2, e = 1e6, m, ans = 1e6;

    while (s <= e) {
        m = (s + e) >> 1;

        ll block = (m + 1) / 2;
        ll val = (2 * block) * (2 * block);
        if (m % 2) {
            val -= 4;
        }
        if (val > n) {
            ans = m;
            e = m - 1;
        }
        else {
            s = m + 1;
        }
    }



    ll block = (ans + 1) / 2;
    cout << setprecision(12);
    if (ans % 2 == 0) {
        cout << sqrtl(block * block + block * block) << el;
    }
    else {
        cout << sqrtl((block - 1) * (block - 1) + block * block) << el;
    }
}

signed main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
#ifndef ONLINE_JUDGE
    if (sublime) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
#endif
    int tests = 1;
    if (multipleTestCases) {
        cin >> tests;
    }
    for (int tc = 1; tc <= tests; tc++) {
        doWork();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3708kb

input:

11

output:

2.2360679775

result:

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

Test #2:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

59

output:

5

result:

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

Test #3:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

1

output:

1.41421356237

result:

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

Test #4:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

2

output:

1.41421356237

result:

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

Test #5:

score: 0
Accepted
time: 2ms
memory: 3748kb

input:

3

output:

1.41421356237

result:

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

Test #6:

score: 0
Accepted
time: 2ms
memory: 3620kb

input:

4

output:

2.2360679775

result:

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

Test #7:

score: -100
Wrong Answer
time: 2ms
memory: 3640kb

input:

1000000000

output:

22360.8377526

result:

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