#3772: WA(line:14)我有考慮錯誤還是少考慮什麼嗎?


no306100 (JamesQAQ)


#include <iostream>
using namespace std;

int main()
{
    int n;
    double x1,y1,x3,y3,x2,y2;
    while (cin>>n)
    {
        for (int i=0;i<n;i++)
        {
            cin>>x1>>y1>>x3>>y3>>x2>>y2;
            if (((x2>=x1)&&(x2<=x3))&&((y2>=y1)&&(y2<=y3)))
            {
                if ((x3-x2)/(y3-y2)==(x3-x1)/(y3-y1))
                    cout<<"該死的東西!竟敢想讓我死!"<<endl;
                else if ((y3-y2)/(x3-x2)==(y3-y1)/(x3-x1))
                    cout<<"該死的東西!竟敢想讓我死!"<<endl;
                else if ((x1==x2)&&(x2==x3)&&(y1==y2)&&(y2==y3))
                    cout<<"該死的東西!竟敢想讓我死!"<<endl;
                else
                    cout<<"父親大人!母親大人!我快到了!"<<endl;
            }
            else
                cout<<"父親大人!母親大人!我快到了!"<<endl;
        }
    }
    //system("pause");
    return 0;
}

WA(line:14)兩次了....

#3774: Re:WA(line:14)我有考慮錯誤還是少考慮什麼嗎?


no306100 (JamesQAQ)


#include
using namespace std;

int main()
{
    int n;
    double x1,y1,x3,y3,x2,y2;
    while (cin>>n)
    {
        for (int i=0;i        {
            cin>>x1>>y1>>x3>>y3>>x2>>y2;
            if (((x2>=x1)&&(x2<=x3))&&((y2>=y1)&&(y2<=y3)))
            {
                if ((x3-x2)/(y3-y2)==(x3-x1)/(y3-y1))
                    cout<<"該死的東西!竟敢想讓我死!"<                else if ((y3-y2)/(x3-x2)==(y3-y1)/(x3-x1))
                    cout<<"該死的東西!竟敢想讓我死!"<                else if ((x1==x2)&&(x2==x3)&&(y1==y2)&&(y2==y3))
                    cout<<"該死的東西!竟敢想讓我死!"<                else
                    cout<<"父親大人!母親大人!我快到了!"<            }
            else
                cout<<"父親大人!母親大人!我快到了!"<        }
    }
    //system("pause");
    return 0;
}

WA(line:14)兩次了....

燒死的第三個我改了...

else if (((x1==x2)&&(y1==y2))||((x2==x3)&&(y2==y3)))

 還是WA line14....

#4061: Re:WA(line:14)我有考慮錯誤還是少考慮什麼嗎?


peng571 (^^)


 
你少考慮了一個條件喔
 
如果測資是 4 4 2 2 3 3 .....