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.