QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#137299#2350. Integer CowS_Explosion#Compile Error//C++201.2kb2023-08-10 09:56:392023-08-10 09:56:40

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-10 09:56:40]
  • 评测
  • [2023-08-10 09:56:39]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long double ld;
typedef long long ll;
const ld eps=1e-10;
int T;
ll r,xc,yc,x0,y0,ansx,ansy,ans;
ld x1,y1,l;
ll dist2(ll x1,ll y1,ll x2,ll y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
ld dist(ld x1,ld y1,ld x2,ld y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
bool is_point_in_circle(ll x0,ll y0,ll xc,ll yc,ll r){
    return dist2(x0,y0,xc,yc)<=r*r;
}
int main(){
    ios::sync_with_stdio(false);
    ll x,y;
    cin>>T;
    while(T--){
        ans=9e18;
        cin>>xc>>yc>>r>>x0>>y0;
        if(is_point_in_circle(x0,y0,xc,yc,r)){
            cout<<0<<'\n';
            cout<<x0<<' '<<y0<<'\n';
            continue;
        }
        l=dist(x0,y0,xc,yc);
        x1=((l-r)*xc+r*x0)/l;
        y1=((l-r)*yc+r*y0)/l;
        for(x=x1-10;x<=x1+10;x++)
            for(y=y1-10;y<=y1+10;y++){
                if(!is_point_in_circle(x,y,xc,yc,r))
                    continue;
                ll cur=dist2(x0,y0,x,y);
                if(cur<ans)
                    ans=cur,ansx=x,ansy=y;
            }
        cout<<1<<'\n';
        cout<<x0<<' '<<y0<<' '<<ansx<<' '<<ansy<<'\n';
    }
    return 0;
}

详细

answer.code:9:15: error: ‘ll y0’ redeclared as different kind of entity
    9 | ll r,xc,yc,x0,y0,ansx,ansy,ans;
      |               ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571,
                 from /usr/include/c++/11/iostream:38,
                 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:10:7: error: ‘ld y1’ redeclared as different kind of entity
   10 | ld x1,y1,l;
      |       ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:571,
                 from /usr/include/c++/11/iostream:38,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration ‘double y1(double)’
  221 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:26:27: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’)
   26 |         cin>>xc>>yc>>r>>x0>>y0;
      |         ~~~~~~~~~~~~~~~~~~^~~~
      |                       |     |
      |                       |     double(double) noexcept
      |                       std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/11/iostream:40,
                 from answer.code:1:
/usr/include/c++/11/istream:120:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  120 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/11/istream:120:7: note:   conversion of argument 1 would be ill-formed:
answer.code:26:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)’ {aka ‘std::basic_istream<char>& (*)(std::basic_istream<char>&)’} [-fpermissive]
   26 |         cin>>xc>>yc>>r>>x0>>y0;
      |                             ^~
      |                             |
      |                             double (*)(double) noexcept
In file included from /usr/include/c++/11/iostream:40,
                 from answer.code:1:
/usr/include/c++/11/istream:124:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’ (near match)
  124 |       operator>>(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/11/istream:124:7: note:   conversion of argument 1 would be ill-formed:
answer.code:26:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’} [-fpermissive]
   26 |         cin>>xc>>yc>>r>>x0>>y0;
      |                             ^~
      |                             |
      |                             double (*)(double) noexcept
In file included from /usr/include/c++/11/iostream:40,
                 from answer.code:1:
/usr/include/c++/11/istream:131:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>]’ (near match)
  131 |       operator>>(ios_base& (*__pf)(ios_base&))
      |       ^~~~~~~~
/usr/include/c++/11/istream:131:7: note:   conversion of argument 1 would be ill-formed:
answer.code:26:29: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘std::ios_base& (*)(std::ios_base&)’ [-fpermissive]
   26 |         cin>>xc>>yc>>r>>x0>>y0;
      |                             ^~
      |                             |
      |                             double (*)(double) noexcept
In file included from /usr/include/c++/11/iostream:40,
                 from answer.code:1:
/usr/include/c++/11/istream:168:7: note: c...