From 2b32bd38e3a8da93de933192c42e2317dbe80a73 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 26 Nov 2024 13:45:22 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EC=8A=88=20#394=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=86=94=EB=A3=A8=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Programmers/\355\217\211\355\226\211.cpp" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "Programmers/\355\217\211\355\226\211.cpp" diff --git "a/Programmers/\355\217\211\355\226\211.cpp" "b/Programmers/\355\217\211\355\226\211.cpp" new file mode 100644 index 0000000..b030ef0 --- /dev/null +++ "b/Programmers/\355\217\211\355\226\211.cpp" @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; + +double calculateSlope(const vector& point1, const vector& point2) { + return static_cast(point2[1] - point1[1]) / (point2[0] - point1[0]); +} + +int solution(vector> dots) { + if (calculateSlope(dots[0], dots[1]) == calculateSlope(dots[2], dots[3])) return 1; + if (calculateSlope(dots[0], dots[2]) == calculateSlope(dots[1], dots[3])) return 1; + if (calculateSlope(dots[0], dots[3]) == calculateSlope(dots[1], dots[2])) return 1; + + return 0; +} \ No newline at end of file