QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535535#9227. Henry the Plumberucup-team3282Compile Error//C++14948b2024-08-28 09:29:552024-08-28 09:29:56

Judging History

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

  • [2024-08-28 09:29:56]
  • 评测
  • [2024-08-28 09:29:55]
  • 提交

answer

#include <iostream>
#include <cmath>
using namespace std;
const double eps=1e-8;

int T;
int x1,y1,z1,p1,q1,x2,y2,z2,p2,q2;


int main(){
	ios::sync_with_stdio(0);
	cin>>T;
	while(T--){
		cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
		if( (x1-x2)*p1+(y1-y2)*q1 == 0 && (x1-x2)*p2+(y1-y2)*q2 == 0 ){
			cout<<2<<endl;
			continue;
		}
		if( p1*q2 == p2*q1 ){
			cout<<4<<endl;
			continue;
		}
		int C1=-p1*x1-q1*y1,C2=-p2*x2-q2*y2;
		double x0=(q1*C2-q2*C1)/(p1*q2-p2*q1);
		double y0=( q1!=0 ? (-C1-p1*x0)/q1 : (-C2-p2*x0)/q2 );
//		cout<<x0<<' '<<y0<<endl;
		if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
			if(z1==z2)
				cout<<4<<endl;
			else
				cout<<3<<endl;
			continue;
		}
		double a=1,b=-z1-z2,c=z1*z2+(x0-x1)*(x0-x2)+(y0-y1)*(y0-y2);
		double delta=(b*b-4*a*c);
		if(delta>=-eps){
			cout<<3<<endl;
		}
		else{
			cout<<4<<endl;
		}
	}
	
	
	return 0;
}

Details

answer.code:7:8: error: ‘int y1’ redeclared as different kind of entity
    7 | int x1,y1,z1,p1,q1,x2,y2,z2,p2,q2;
      |        ^~
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/bits/requires_hosted.h:31,
                 from /usr/include/c++/13/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:14:24: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) throw ()’ {aka ‘double(double)’})
   14 |                 cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
      |                 ~~~~~~~^~~~
      |                    |     |
      |                    |     double(double) throw () {aka double(double)}
      |                    std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/13/iostream:42:
/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:14:26: error: invalid conversion from ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} to ‘void*’ [-fpermissive]
   14 |                 cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
      |                          ^~
      |                          |
      |                          double (*)(double) throw () {aka double (*)(double)}
answer.code:14:26: error: cannot bind rvalue ‘(void*)y1’ 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:14:26: error: invalid conversion from ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} to ‘long long unsigned int’ [-fpermissive]
   14 |                 cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
      |                          ^~
      |                          |
      |                          double (*)(double) throw () {aka double (*)(double)}
answer.code:14:26: error: cannot bind rvalue ‘(long long unsigned int)y1’ 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:14:26: error: invalid conversion from ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} to ‘long long int’ [-fpermissive]
   14 |                 cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
      |                          ^~
      |                          |
      |                          double (*)(double) throw () {aka double (*)(double)}
answer.code:14:26: error: cannot bind rvalue ‘(long long int)y1’ 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:14:26: error: invalid conversion from ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} to ‘long unsigned int’ [-fpermissive]
   14 |                 cin>>x1>>y1>>z1>>p1>>q1>>x2>>y2>>z2>>p2>>q2;
      |                          ^~
      |                          |
      |                          double (*)(double) throw () {aka double (*)(double)}
answer.code:14:26: error: cannot bind rvalue ‘(long unsigned int)y1’ 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>::op...