CF21B Intersection

· · 个人记录

/*
初中数学 二元一次方程
单个方程是否无解
两条直线平行、重合、相交三种关系的判断。
竟然评了蓝,不合理。
*/
#include<bits/stdc++.h>
using namespace std;
int a[4],b[4];
bool wuje(int *c){
    if(c[1]==0&&c[2]==0&&c[3]!=0) return 1;
    return 0;
} 
int main(){
    cin>>a[1]>>a[2]>>a[3];
    cin>>b[1]>>b[2]>>b[3];
    if(wuje(a)||wuje(b))cout<<0<<endl;
    else if(a[1]*b[2]!=a[2]*b[1]) cout<<1<<endl;
    else if(a[1]*b[3]!=b[1]*a[3]||a[2]*b[3]!=b[2]*a[3])cout<<0<<endl;
    else cout<<-1<<endl;
}