change default zeta_C compiler to gcc & complete 10815.c

This commit is contained in:
yenru0 committed 2024-04-16 03:11:22 +09:00
1 parent 35f80a6125
commit 6534975013
3 files changed
+61 -1

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int N, M;
char[]
scanf("%d %d", &N, &M);
return 0;
}
+49
View File
@@ -0,0 +1,49 @@
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b) {
return *(int *) a - *(int *) b;
}
int is_in(int x, int *cards, int size) {
int begin = 0, end = size - 1, mid;
while (begin <= end) {
mid = (begin + end) / 2;
if (cards[mid] == x) {
return 1;
} else if (cards[mid] > x) {
end = mid - 1;
} else {
begin = mid + 1;
}
}
return 0;
}
int main() {
int N;
scanf("%d", &N);
int cards[N];
for (int i = 0; i < N; i++) {
scanf("%d", &cards[i]);
}
qsort(cards, N, sizeof(int), comp);
int M;
scanf("%d", &M);
int check[M];
for (int i = 0; i < M; i++) {
scanf("%d", &check[i]);
}
for (int i = 0; i < M - 1; i++) {
printf("%d ", is_in(check[i], cards, N));
}
printf("%d\n", is_in(check[M - 1], cards, N));
return 0;
}
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
if [ -z "$*" ]; then echo "No args"; exit 0; fi
clang-18 -std=c11 $1
gcc -std=c11 $1
./a.out < stdin.txt