QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535538#9227. Henry the Plumberucup-team3282Compile Error//C++14990b2024-08-28 09:30:552024-08-28 09:30:56

Judging History

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

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

answer

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

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

double fabs(double x,double y){
	return (x>y?x-y:y-x);
}

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: In function ‘int main()’:
answer.code:29:26: error: too few arguments to function ‘double fabs(double, double)’
   29 |                 if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
      |                      ~~~~^~~~~~~
answer.code:8:8: note: declared here
    8 | double fabs(double x,double y){
      |        ^~~~
answer.code:29:45: error: too few arguments to function ‘double fabs(double, double)’
   29 |                 if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
      |                                         ~~~~^~~~~~~
answer.code:8:8: note: declared here
    8 | double fabs(double x,double y){
      |        ^~~~
answer.code:29:66: error: too few arguments to function ‘double fabs(double, double)’
   29 |                 if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
      |                                                              ~~~~^~~~~~~
answer.code:8:8: note: declared here
    8 | double fabs(double x,double y){
      |        ^~~~
answer.code:29:85: error: too few arguments to function ‘double fabs(double, double)’
   29 |                 if(( fabs(x0-x1)<eps && fabs(y0-y1)<eps )||( fabs(x0-x2)<eps && fabs(y0-y2)<eps )){
      |                                                                                 ~~~~^~~~~~~
answer.code:8:8: note: declared here
    8 | double fabs(double x,double y){
      |        ^~~~