QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#246693#5152. Circular Caramel Cookiethanhchauns2#WA 0ms3892kbC++202.2kb2023-11-11 00:26:582023-11-11 00:26:58

Judging History

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

  • [2023-11-11 00:26:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2023-11-11 00:26:58]
  • 提交

answer

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
//@etohari
using namespace std;
using namespace __gnu_pbds;

#define my_wife "She belongs to another guy"
#define bit(mask,i) ((mask >> i)&1)
#define cntbit(mask) __builtin_popcountll(mask)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define sz(s) (int32_t)s.size()
#define __lcm(a,b) ((int64_t)a / __gcd(a, b) * b)
#define rand(l, r) uniform_int_distribution < int64_t > (l, r)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree < int32_t, null_type, less < int32_t >, rb_tree_tag,tree_order_statistics_node_update >

void etohari();
void init(){};

signed main() {
        cin.tie(NULL)->sync_with_stdio(false);
        // https://www.facebook.com/hai290605
        constexpr bool MULTITEST = 0;
        // https://codeforces.com/profile/I_Will_Marry_Ngoc
        init();
        int32_t test = 1;
        if (MULTITEST) cin >> test;
        for (int32_t i_test = 1; i_test <= test; i_test ++){
                etohari();
                cout << "\n";
        }
        return (0 ^ 0);
}

template < class T > bool minimum(T& a, T& b) { return b < a ? a = b, 1 : 0; }
template < class T > bool maximum(T& a, T& b) { return a < b ? a = b, 1 : 0; }

constexpr int32_t MAXN = 1e3 + 10;
constexpr int32_t MAXM = 1e6 + 10; 
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t INF = 0x3f3f3f3f;
constexpr long double PI = 3.14159265358979323846;

constexpr int16_t DR[] = { };
constexpr int16_t DC[] = { };

#define int int64_t

void etohari(){ 
        int s;
        cin >> s;

        long double ans = 1e30;

        for (int r = 1; r * (r - 100) <= s; r ++){
                int x = s / r;
                x += r;
                x /= 2;
                for (int i = 0; i < 2; i ++){
                        int c = x + i;
                        if (r * c * 2 - min(r, c) * min(r, c) >= s)
                        ans = min(ans, (long double)sqrt(r * r + c * c) / 2);
                }
        }

        cout << fixed << setprecision(20) << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2.23606797749978980505

result:

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

Test #2:

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

input:

59

output:

5.00000000000000000000

result:

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

Test #3:

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

input:

1

output:

0.70710678118654757274

result:

wrong answer 1st numbers differ - expected: '1.4142136', found: '0.7071068', error = '0.5000000'