結果

問題 No.306 さいたま2008
ユーザー mdj982mdj982
提出日時 2015-12-31 15:43:14
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,075 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 92,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 08:58:07
合計ジャッジ時間 1,365 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
//#include "toollib.h"
#define INT_MAX 2147483647
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#pragma warning (disable:4018)

using namespace std;
typedef long long int lint;
typedef struct {
	int x;
	int y;
}coordinate;

//***** Main Program *****

tuple<double, double, double> line_formula(double x1, double y1, double x2, double y2) {
	if (x1 == x2) {
		return tuple<double, double, double>(1.0, 0, x1*(-1));
	}
	else if (y1 == y2) {
		return tuple<double, double, double>(0, 1.0, y1*(-1));
	}
	else {
		double a = y2 - y1;
		double b = x1 - x2;
		double c = x2*y1 - x1*y2;
		return tuple<double, double, double>(a, b, c);
	}
}

int main() {
	coordinate A, B, P;
	cin >> A.x >> A.y;
	cin >> B.x >> B.y;
	tuple<double, double, double> line = line_formula(A.x, A.y, (-1)*B.x, B.y);
	cout << (-1)*get<2>(line) / get<1>(line) << endl;
	return 0;
}
0