http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0021&lang=jp
#include <iostream>
#include <string>
using namespace std;
int main (int argc, const char * argv[])
{
double read;
int set;
double x[4],y[4];
cin >> set;
for (int i=0; i < set; i++) {
int count = 0;
for (int j=0; j < 8; j++) {
cin >> read;
if (j % 2 == 0) {
x[count] = read;
}else {
y[count] = read;
count++;
}
}
double a = (y[0] - y[1]) / (x[0] - x[1]);
double b = (y[2] - y[3]) / (x[2] - x[3]);
if (a == b) {
cout << "YES\n";
}else {
cout << "NO\n";
}
}
return 0;
}