about summary refs log tree commit diff
path: root/coci
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 /coci
parent67393f42f41ab92219deb549f711121c4dab845b (diff)
downloadcp-9e28e4c7b67c54229df11d355047ac8a88ea1817.tar.gz
Normalize pathname
Diffstat (limited to 'coci')
-rw-r--r--coci/2006-2007/contest1/herman.c15
-rw-r--r--coci/2006-2007/contest1/modulo.c21
-rw-r--r--coci/2006-2007/contest1/okviri.c69
-rw-r--r--coci/README.md5
4 files changed, 110 insertions, 0 deletions
diff --git a/coci/2006-2007/contest1/herman.c b/coci/2006-2007/contest1/herman.c
new file mode 100644
index 0000000..718a3ad
--- /dev/null
+++ b/coci/2006-2007/contest1/herman.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+	short r;
+	long r2;
+
+	scanf("%hd", &r);
+	r2 = r * r;
+
+	printf("%.6f\n%ld.000000\n", r2 * M_PI, r2 * 2);
+
+	return 0;
+}
diff --git a/coci/2006-2007/contest1/modulo.c b/coci/2006-2007/contest1/modulo.c
new file mode 100644
index 0000000..14c0556
--- /dev/null
+++ b/coci/2006-2007/contest1/modulo.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main()
+{
+	char i, mod[42] = {};
+	short a;
+
+	for (i = 0; i < 10; i++) {
+		scanf("%hd", &a);
+		mod[a % 42]++;
+	}
+
+	a = 0;
+	for (i = 0; i < 42; i++)
+		if (mod[i])
+			a++;
+
+	printf("%hd\n", a);
+
+	return 0;
+}
diff --git a/coci/2006-2007/contest1/okviri.c b/coci/2006-2007/contest1/okviri.c
new file mode 100644
index 0000000..33d186c
--- /dev/null
+++ b/coci/2006-2007/contest1/okviri.c
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <string.h>
+
+void ln1(char len)
+{
+	char i;
+
+	for (i = 0; i < len; i++) {
+		if (i % 12 == 10)
+			putchar(42);
+		else if (i % 4 == 2)
+			putchar(35);
+		else
+			putchar(46);
+	}
+
+	putchar(10);
+}
+
+void ln2(char len)
+{
+	char i;
+
+	for (i = 0; i < len; i++) {
+		if (i % 12 == 9 || i % 12 == 11)
+			putchar(42);
+		else if (i % 2)
+			putchar(35);
+		else
+			putchar(46);
+	}
+
+	putchar(10);
+}
+
+void ln3(char *s)
+{
+	char i;
+
+	printf("#.%c.", *s);
+
+	for (i = 1; i < strlen(s); i++) {
+		if (i % 3 == 1)
+			printf("#.%c.", s[i]);
+		else
+			printf("*.%c.", s[i]);
+	}
+
+	if (strlen(s) % 3)
+		puts("#");
+	else
+		puts("*");
+}
+
+int main()
+{
+	char s[16], len;
+
+	scanf("%s", s);
+	len = strlen(s) * 4 + 1;
+
+	ln1(len);
+	ln2(len);
+	ln3(s);
+	ln2(len);
+	ln1(len);
+
+	return 0;
+}
diff --git a/coci/README.md b/coci/README.md
new file mode 100644
index 0000000..9dac833
--- /dev/null
+++ b/coci/README.md
@@ -0,0 +1,5 @@
+# CROATIAN OPEN COMPETITION IN INFORMATICS
+
+## COCI 2006-2007
+
+- [ ] [Contest 1](http://www.hsin.hr/coci/archive/2006_2007/contest1_tasks.pdf)