QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743227#9576. Ordainer of Inexorable JudgmenthjxddlCompile Error//C++202.2kb2024-11-13 18:38:022024-11-13 18:38:03

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-14 21:58:28]
  • hack成功,自动添加数据
  • (/hack/1181)
  • [2024-11-13 18:38:03]
  • 评测
  • [2024-11-13 18:38:02]
  • 提交

answer

// Coded by hjxddl
#include <bits/stdc++.h>
#define ll long long
#define db double
const db pi = acos(-1);
const int N = 2e5 + 5;
int n;
db x0, y0, d, t;
void solve() {
    std::cin >> n >> x0 >> y0 >> d >> t;
    db max1 = -1e9, min1 = 1e9, delta = -1e9;
    std::vector<db> A;
    for (int i = 1; i <= n; i++) {
        db x, y;
        std::cin >> x >> y;
        db a, b;
        if (x == d || x == -d)
            a = pi / 2;
        else {
            a = (x * y + d * (sqrt(x * x + y * y - d * d))) / (x * x - d * d);
            a = atan(a);
        }
        if (y == d || y == -d)
            b = 0;
        else {
            if (x != d && x != -d)
                b = (x * y - d * (sqrt(x * x + y * y - d * d))) / (x * x - d * d);
            else
                b = (y * y - d * d) / d / 2 / y;
            // std::cout << b << " " << (x == d || x == -d) << '\n';
            b = atan(b);
        }
        if (y < 0) a += pi;
        if (y < 0) b += pi;
        A.push_back(a);
        A.push_back(b);
        A.push_back(a + 2 * pi);
        A.push_back(b + 2 * pi);
        // std::cout << a << " " << b << '\n';
    }
    int n1 = A.size();
    for (int i = 0; i < n1; i++) {
        for (int j = 0; j < n1; j++) {
            if (fabs(A[i] - A[j]) <= pi && fabs(A[i] - A[j]) >= delta) {
                delta = fabs(A[i] - A[j]);
                max1 = std::max(A[i], A[j]);
                min1 = std::min(A[i], A[j]);
                // std::cout << A[i] << " " << A[j] << '\n';
            }
        }
    }
    db ans = 0;
    ans += db(int(t / 2 / pi)) * delta;
    t -= db(int(t / 2 / pi)) * 2 * pi;
    db now;
    if (x0)
        now = atan(y0 / x0);
    else
        now = pi / 2;
    if (y0 < 0) now += pi;
    db now1 = now + t;
    if (min1 >= 2 * pi) max1 -= 2 * pi, min1 -= 2 * pi;
    ans += std::min(now1, max1) - std::max(now, min1);
    std::cout << std::fixed << std::setprecision(10) << ans << '\n';
}
int main() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0), std::cout.tie(0);
    int t = 1;
    // std::cin >> t;
    while (t--) {
        solve();
    }
    std::cout << std::flush;
    system("pause");
}

详细

answer.code:8:8: error: ‘double y0’ redeclared as different kind of entity
    8 | db x0, y0, d, t;
      |        ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33,
                 from answer.code:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’
  220 | __MATHCALL (y0,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘void solve()’:
answer.code:10:25: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’)
   10 |     std::cin >> n >> x0 >> y0 >> d >> t;
      |     ~~~~~~~~~~~~~~~~~~~ ^~ ~~
      |                   |        |
      |                   |        double(double) noexcept
      |                   std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:10:28: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive]
   10 |     std::cin >> n >> x0 >> y0 >> d >> t;
      |                            ^~
      |                            |
      |                            double (*)(double) noexcept
answer.code:10:28: error: cannot bind rvalue ‘(void*)y0’ to ‘void*&’
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:10:28: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive]
   10 |     std::cin >> n >> x0 >> y0 >> d >> t;
      |                            ^~
      |                            |
      |                            double (*)(double) noexcept
answer.code:10:28: error: cannot bind rvalue ‘(long long unsigned int)y0’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:10:28: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive]
   10 |     std::cin >> n >> x0 >> y0 >> d >> t;
      |                            ^~
      |                            |
      |                            double (*)(double) noexcept
answer.code:10:28: error: cannot bind rvalue ‘(long long int)y0’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:10:28: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive]
   10 |     std::cin >> n >> x0 >> y0 >> d >> t;
      |                            ^~
      |                            |
      |                            double (*)(double) noexcept
answer.code:10:28: error: cannot bind rvalue ‘(long unsigned int)y0’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |    ...