Moved kattis from Uni repo

This commit is contained in:
2023-12-01 13:35:13 +01:00
parent 28a6b807a3
commit aaa2c123b8
164 changed files with 3008 additions and 0 deletions

View File

@ -0,0 +1,2 @@
ahjmnoy
acijjkll

View File

@ -0,0 +1,61 @@
#include <string.h>
#include <stdio.h>
// void concatForEach(char *a, char *b, char *target ) {
// int lenA = strlen(a);
// int lenB = strlen(b);
// // We use the smaller one
// char *using = lenA > lenB ? b : a;
// int usingLen = lenA > lenB ? lenB : lenA;
// int i;
// for (i=0; i < usingLen; i+=2) {
// target[i] = a[i];
// target[i+1] = b[i];
// }
// // Now we use the bigger one
// char *new = lenA > lenB ? a : b;
// int newLen = lenA > lenB ? lenA : lenB;
// for (; i < newLen-usingLen; i++) {
// target[i] = a[i];
// }
// return;
// }
int main(int argc, char **argv) {
char ann[100];
char ben[100];
scanf("%s", ann);
scanf("%s", ben);
char total[200];
// Concatenate
strcat(total, ann);
strcat(total, ben);
// Alphabetical sort
int len = strlen(total);
int i, j;
for (i=0; i < len; i++) {
for (j=0; j < len-i-1; j++) {
if (total[j] > total[j+1]) {
char temp = total[j];
total[j] = total[j+1];
total[j+1] = temp;
}
}
}
for (i=0; i < len; i++) {
printf("%c", total[i]);
}
printf("\r\n");
return 0;
}

View File

@ -0,0 +1,61 @@
#include <string.h>
#include <stdio.h>
// void concatForEach(char *a, char *b, char *target ) {
// int lenA = strlen(a);
// int lenB = strlen(b);
// // We use the smaller one
// char *using = lenA > lenB ? b : a;
// int usingLen = lenA > lenB ? lenB : lenA;
// int i;
// for (i=0; i < usingLen; i+=2) {
// target[i] = a[i];
// target[i+1] = b[i];
// }
// // Now we use the bigger one
// char *new = lenA > lenB ? a : b;
// int newLen = lenA > lenB ? lenA : lenB;
// for (; i < newLen-usingLen; i++) {
// target[i] = a[i];
// }
// return;
// }
int main(int argc, char **argv) {
char ann[100];
char ben[100];
scanf("%s", ann);
scanf("%s", ben);
char total[200];
// Concatenate
strcat(total, ann);
strcat(total, ben);
// Alphabetical sort
int len = strlen(total);
int i, j;
for (i=0; i < len; i++) {
for (j=0; j < len-i-1; j++) {
if (total[j] > total[j+1]) {
char temp = total[j];
total[j] = total[j+1];
total[j+1] = temp;
}
}
}
// Print
printf("%s\n", total);
return 0;
}

View File

@ -0,0 +1,10 @@
ann = input()
bob = input()
total = ann + bob
sorted_total = sorted(total)
print("".join(sorted_total))

Binary file not shown.

View File

@ -0,0 +1 @@
Firing up EmoticonBot... (: : ( ): :D c:

View File

@ -0,0 +1,43 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char c;
int smiley = 0;
int frowny = 0;
int eyes = 0;
// Would be easier if we stored it but why tf not ig
int i = 0;
while ((c = getchar()) != '\n') {
// PROUD OF THIS
// ↓↓↓↓↓↓↓↓↓↓↓↓↓
if (i - eyes > 1) {
eyes = 0;
}
if (c == ':') {
eyes = i;
}
if (c == ')' && eyes ) {
smiley++;
}
if (c == '(' && eyes) {
frowny++;
}
i++;
}
if (frowny && ! smiley) {
printf("undead\n");
} else if (smiley && !frowny) {
printf("alive\n");
} else if (smiley && frowny) {
printf("double agent\n");
} else {
printf("machine\n");
}
return 0;
}

Binary file not shown.

View File

@ -0,0 +1,2 @@
PpIiKkAaCcHhUu
001004006008010012014

View File

@ -0,0 +1,2 @@
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,?!0123456789
016009011001053016009011001

View File

@ -0,0 +1,26 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char translationKey[256];
char c;
int i = 0;
while ((c = getchar()) != '\n') {
translationKey[i] = c;
i++;
}
while (1) {
int phrase;
int check = scanf("%3d", &phrase);
if (check != 1) {
break;
}
// printf("%d, %d\n", phrase, check);
printf("%c", translationKey[phrase-1]);
}
printf("\n");
return 0;
}

View File

@ -0,0 +1,26 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char translationKey[256];
char c;
int i = 0;
while ((c = getchar()) != '\n') {
translationKey[i] = c;
i++;
}
while (1) {
int phrase;
int check = scanf("3%d", &phrase);
if (check != 1) {
break;
}
printf("%c\n", translationKey[phrase-1]);
}
printf("\n");
return 0;
}

Binary file not shown.