about summary refs log tree commit diff
path: root/usth/MATH2.3/4/threshold.c
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-14 18:29:11 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-14 18:29:11 +0700
commita3dd2581ed4847670f81157091016c14ca18803d (patch)
tree3362ab15de119f1e75799f58715b7683e6bfd6ca /usth/MATH2.3/4/threshold.c
parent65b8ebda4c47fa27ac28899fb2b29097f445b6df (diff)
downloadcp-a3dd2581ed4847670f81157091016c14ca18803d.tar.gz
[usth/MATH2.3] Mathemate Discretely
Diffstat (limited to 'usth/MATH2.3/4/threshold.c')
-rw-r--r--usth/MATH2.3/4/threshold.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/usth/MATH2.3/4/threshold.c b/usth/MATH2.3/4/threshold.c
new file mode 100644
index 0000000..5c39b3c
--- /dev/null
+++ b/usth/MATH2.3/4/threshold.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+	size_t n;
+	scanf("%zu", &n);
+
+	double t, *weights = malloc(n * sizeof(double));
+	scanf("%lf", &t);
+	for (size_t i = 0; i < n; ++i)
+		scanf("%lf", weights + i);
+
+	int tmp;
+	for (size_t i = 0; i < n; ++i) {
+		scanf("%d", &tmp);
+		t -= tmp && weights[i];
+	}
+
+	putchar((t <= 0) + 48);
+	putchar(10);
+	return 0;
+}