about summary refs log tree commit diff
path: root/NTU/moco.c
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-12-15 15:09:13 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-12-15 15:09:13 +0700
commit9e28e4c7b67c54229df11d355047ac8a88ea1817 (patch)
tree0d9d40db69613c2c49564a3f1987a005d61f4db3 /NTU/moco.c
parent67393f42f41ab92219deb549f711121c4dab845b (diff)
downloadcp-9e28e4c7b67c54229df11d355047ac8a88ea1817.tar.gz
Normalize pathname
Diffstat (limited to 'NTU/moco.c')
-rw-r--r--NTU/moco.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/NTU/moco.c b/NTU/moco.c
deleted file mode 100644
index 9354a0f..0000000
--- a/NTU/moco.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <stdio.h>
-
-typedef struct {
-	short x;
-	short y;
-} point_t;
-
-point_t a, b, c, d;
-
-long long cross_product(point_t m, point_t n, point_t p, point_t q)
-{
-	return (n.x - m.x) * (q.y - p.y) - (q.x - p.x) * (n.y - m.y);
-}
-
-char convex()
-{
-	if (cross_product(a, c, c, b) * cross_product(a, c, c, d) > 0)
-		return 0;
-	if (cross_product(b, d, d, a) * cross_product(b, d, d, c) > 0)
-		return 0;
-	return 1;
-}
-
-void swap(point_t *m, point_t *n)
-{
-	short tmp = m->x;
-	m->x = n->x;
-	n->x = tmp;
-	tmp = m->y;
-	m->y = n->y;
-	n->y = tmp;
-}
-
-long long dot_product(point_t m, point_t n, point_t p, point_t q)
-{
-	return (n.x - m.x) * (q.x - p.x) + (n.y - m.y) * (q.y - p.y);
-}
-
-char f2()
-{
-	return !dot_product(a, b, b, c);
-}
-
-char f3()
-{
-	return !dot_product(a, c, b, d);
-}
-
-char f4()
-{
-	return (a.x + c.x == b.x + d.x) && (a.y + c.y == b.y + d.y);
-}
-
-int main()
-{
-	scanf("%hd %hd %hd %hd %hd %hd %hd %hd",
-	      &a.x, &a.y, &b.x, &b.y, &c.x, &c.y, &d.x, &d.y);
-
-	if (!convex()) {
-		swap(&a, &b);
-		if (!convex())
-			swap(&b, &c);
-	}
-
-	char val = 5;
-	if (f4()) {
-		val = 4;
-		if (f2())
-			val = 2;
-		if (f3())
-			val--;
-	}
-
-	printf("%hhd\n", val);
-
-	return 0;
-}