QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#800432#9576. Ordainer of Inexorable JudgmentHanoistCompile Error//C++141.7kb2024-12-06 10:37:182024-12-06 10:37:19

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-12-06 10:37:19]
  • 评测
  • [2024-12-06 10:37:18]
  • 提交

answer

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<functional>
#include<utility>
#include<cassert>
using namespace std;
const int N = 111;
#define pi acos(-1)
int n;
struct vec{
    double x,y;
}a[N],sl[N << 1];
double x0,y0,d,t;
inline double Dis(vec a,vec b){
    return 1.0 * sqrt((a.y - b.y) * (a.y - b.y) + (a.x - b.x) * (a.x - b.x));
}
bool cmp(vec u,vec v){
    if(u.x != v.x) return u.x < v.x;
    return u.y < v.y;
}
int main(){
    int i,j,k,x,y;
    vec O = {0,0};
    scanf("%d %lf %lf %lf %lf",&n,&x0,&y0,&d,&t);
    for(i = 1;i <= n;i++){
        scanf("%lf %lf",&a[i].x,&a[i].y);
    }
    for(i = 1;i <= n;i++){
        double p = atan2(a[i].y,a[i].x);
        double q = abs(acos(d / Dis(a[i],O)));
        sl[i].x = p + q - pi / 2,sl[i].y = p - q + pi / 2;
        //printf("%lf %lf\n",sl[i].x,sl[i].y);
    }
    sort(sl + 1,sl + n + 1,cmp);
    for(i = 1;i <= n;i++) sl[i + n] = {sl[i].x + 2 * pi,sl[i].y + 2 * pi};
    double res1,res2,res;
    for(i = 1;i <= n;i++){
        if(sl[n + i - 1].y - sl[i].x <= pi){
            res1 = sl[n + i - 1].y - sl[i].x;
            k = i;
            break;
        }
    }
    res = (int)(t / 2 / pi) * res1;
    t -= 2 * pi * (int)(t / 2 / pi);
    double st = atan2(y0,x0);
    //printf("%lf %lf %lf\n",st,sl[k].x,sl[n + k - 1].y);
    if(sl[n + k - 1].y - st > 2 * pi) st += 2 * pi;
    if(st < sl[k].x) res += min(res1,max(0.0,t - (sl[k].x - st)));
    else if(st <= sl[n + k - 1].y) res += min(sl[n + k - 1].y - st,t);
    else res += min(res1,max(0.0,t - (sl[k].x + 2 * pi - st)));
    printf("%.12lf\n",res);
    return 0;
}

詳細信息

answer.code:17:11: error: ‘double y0’ redeclared as different kind of entity
   17 | double 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/cstdio:41,
                 from answer.code:1:
/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 ‘int main()’:
answer.code:28:21: warning: format ‘%lf’ expects argument of type ‘double*’, but argument 4 has type ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} [-Wformat=]
   28 |     scanf("%d %lf %lf %lf %lf",&n,&x0,&y0,&d,&t);
      |                   ~~^                 ~~~
      |                     |                 |
      |                     double*           double (*)(double) throw () {aka double (*)(double)}
answer.code:50:22: error: no matching function for call to ‘atan2(double (&)(double) throw (), double&)’
   50 |     double st = atan2(y0,x0);
      |                 ~~~~~^~~~~~~
In file included from answer.code:4:
/usr/include/c++/13/cmath:1052:5: note: candidate: ‘template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::atan2(_Tp, _Up)’
 1052 |     atan2(_Tp __y, _Up __x)
      |     ^~~~~
/usr/include/c++/13/cmath:1052:5: note:   template argument deduction/substitution failed:
/usr/include/c++/13/cmath: In substitution of ‘template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::atan2(_Tp, _Up) [with _Tp = double (*)(double); _Up = double]’:
answer.code:50:22:   required from here
/usr/include/c++/13/cmath:1052:5: error: no type named ‘__type’ in ‘struct __gnu_cxx::__promote<double (*)(double), false>’
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:59:1: note: candidate: ‘double atan2(double, double)’
   59 | __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
      | ^~~~~~~~~~
In file included from /usr/include/c++/13/cmath:47:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:59:1: note:   no known conversion for argument 1 from ‘double(double) throw ()’ {aka ‘double(double)’} to ‘double’
   59 | __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
      | ^
/usr/include/c++/13/cmath:150:3: note: candidate: ‘constexpr long double std::atan2(long double, long double)’
  150 |   atan2(long double __y, long double __x)
      |   ^~~~~
/usr/include/c++/13/cmath:150:21: note:   no known conversion for argument 1 from ‘double(double) throw ()’ {aka ‘double(double)’} to ‘long double’
  150 |   atan2(long double __y, long double __x)
      |         ~~~~~~~~~~~~^~~
/usr/include/c++/13/cmath:146:3: note: candidate: ‘constexpr float std::atan2(float, float)’
  146 |   atan2(float __y, float __x)
      |   ^~~~~
/usr/include/c++/13/cmath:146:15: note:   no known conversion for argument 1 from ‘double(double) throw ()’ {aka ‘double(double)’} to ‘float’
  146 |   atan2(float __y, float __x)
      |         ~~~~~~^~~
answer.code:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |     scanf("%d %lf %lf %lf %lf",&n,&x0,&y0,&d,&t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%lf %lf",&a[i].x,&a[i].y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~