QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#518842#9168. Square LocatorJunWA 0ms3956kbC++141.3kb2024-08-14 13:18:002024-08-14 13:18:00

Judging History

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

  • [2024-08-14 13:18:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3956kb
  • [2024-08-14 13:18:00]
  • 提交

answer

#include <bits/stdc++.h>

#define endl '\n'
#define IOS ios::sync_with_stdio(false),cin.tie(nullptr);
using namespace std;
double AO, BO, CO, DO;

void Jun()
{
    cin >> AO >> BO >> CO >> DO;

    if (AO == 1 && BO == 1 && CO == 1 && DO == 1)
        cout << "1 -1 0 0 -1 1 0" << endl;
    else
    {

        double cx, cy;
        cx = (4 * DO - 2 * AO - 2 * CO) / (4 * sqrt(AO));
        cy = CO - cx * cx;

        double mid_x, mid_y;
        mid_x = cx / 2;
        mid_y = (sqrt(AO) + cy) / 2;

        double deta_x, deta_y;
        deta_x = cx / 2;
        deta_y = (sqrt(AO) - cy) / 2;

        long long dx, dy;
        long long bx, by;
        if (BO <= DO)//B点在左边
        {
            dx = (long long) (mid_x + deta_y), dy = (long long) (mid_y + deta_x);

            bx = (long long) (mid_x - deta_y), by = (long long) (mid_y - deta_x);
        }
        else
        {
            dx = (long long) (mid_x - deta_y), dy = (long long) (mid_y - deta_x);

            bx = (long long) (mid_x + deta_y), by = (long long) (mid_y + deta_x);
        }

        cout << sqrt(AO) << " " << bx << " " << by << " " << cx << " " << cy << " " << dx << " " << dy << endl;
    }
}

signed main()
{
    IOS
    Jun();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

36 5 10 41

output:

6 -1 2 3 1 4 5

result:

ok Answer is correct

Test #2:

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

input:

1 1 1 1

output:

1 -1 0 0 -1 1 0

result:

ok Answer is correct

Test #3:

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

input:

1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output:

1e+09 499999999500000000 500000000500000000 0 1e+18 -499999999500000000 500000000500000000

result:

wrong output format Expected integer, but "1e+09" found