about summary refs log tree commit diff
path: root/09/TP-HN-2014/cau3.c
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-06-06 21:33:13 +0700
commit2f674dc80f0382f1c3178f435714960734dc9d3c (patch)
tree2abba7e4ec72bd16f58f7375126144d3fd9f4bca /09/TP-HN-2014/cau3.c
parentb2d80610db6beda38573890ed169815e495bc663 (diff)
downloadcp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz
Reorganize stuff from secondary school
Diffstat (limited to '09/TP-HN-2014/cau3.c')
-rw-r--r--09/TP-HN-2014/cau3.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/09/TP-HN-2014/cau3.c b/09/TP-HN-2014/cau3.c
deleted file mode 100644
index cbb2ce4..0000000
--- a/09/TP-HN-2014/cau3.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-char ispalin(char *s, unsigned char len)
-{
-	unsigned char i, j;
-	for (i = 0; i < (len + 1) / 2; i++)
-		if (s[i] != s[len - i - 1])
-			return 0;
-	return 1;
-}
-
-unsigned char maxpalin(char s[256])
-{
-	unsigned char i, j, k, len = strlen(s);
-	for (i = len - 1; i; i--)
-		for (j = 0; j + i <= len; j++)
-			if (ispalin(s + j, i))
-				return i;
-}
-
-int main()
-{
-	FILE *f = fopen("CAU3.INP", "r");
-	char s[256];
-	fscanf(f, "%s\n", s);
-	fclose(f);
-
-	unsigned char i, count[128] = {};
-	for (i = 0; i < strlen(s); count[s[i++]]++);
-	for (i = 1; i < 128; i++)
-		if (count[i])
-			(*count)++;
-
-	f = fopen("CAU3.OUT", "w");
-	fprintf(f, "%hhd\n%hhd\n", *count, maxpalin(s));
-	fclose(f);
-
-	return 0;
-}