about summary refs log tree commit diff
path: root/usth/MATH2.3/4/threshold.c
diff options
context:
space:
mode:
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;
+}