Moved kattis from Uni repo
This commit is contained in:
2
kattis/problems/06_11_23/classfieldtrip/1.in
Normal file
2
kattis/problems/06_11_23/classfieldtrip/1.in
Normal file
@ -0,0 +1,2 @@
|
||||
ahjmnoy
|
||||
acijjkll
|
61
kattis/problems/06_11_23/classfieldtrip/main.c
Normal file
61
kattis/problems/06_11_23/classfieldtrip/main.c
Normal 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;
|
||||
}
|
61
kattis/problems/06_11_23/classfieldtrip/main.c.orig
Normal file
61
kattis/problems/06_11_23/classfieldtrip/main.c.orig
Normal 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;
|
||||
}
|
10
kattis/problems/06_11_23/classfieldtrip/main.py
Normal file
10
kattis/problems/06_11_23/classfieldtrip/main.py
Normal file
@ -0,0 +1,10 @@
|
||||
ann = input()
|
||||
bob = input()
|
||||
|
||||
total = ann + bob
|
||||
sorted_total = sorted(total)
|
||||
|
||||
print("".join(sorted_total))
|
||||
|
||||
|
||||
|
BIN
kattis/problems/06_11_23/classfieldtrip/program
Executable file
BIN
kattis/problems/06_11_23/classfieldtrip/program
Executable file
Binary file not shown.
1
kattis/problems/06_11_23/deadoralive/3.in
Normal file
1
kattis/problems/06_11_23/deadoralive/3.in
Normal file
@ -0,0 +1 @@
|
||||
Firing up EmoticonBot... (: : ( ): :D c:
|
43
kattis/problems/06_11_23/deadoralive/main.c
Normal file
43
kattis/problems/06_11_23/deadoralive/main.c
Normal 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;
|
||||
}
|
BIN
kattis/problems/06_11_23/deadoralive/program
Executable file
BIN
kattis/problems/06_11_23/deadoralive/program
Executable file
Binary file not shown.
2
kattis/problems/06_11_23/pokechat/1.in
Normal file
2
kattis/problems/06_11_23/pokechat/1.in
Normal file
@ -0,0 +1,2 @@
|
||||
PpIiKkAaCcHhUu
|
||||
001004006008010012014
|
2
kattis/problems/06_11_23/pokechat/2.in
Normal file
2
kattis/problems/06_11_23/pokechat/2.in
Normal file
@ -0,0 +1,2 @@
|
||||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .,?!0123456789
|
||||
016009011001053016009011001
|
26
kattis/problems/06_11_23/pokechat/main.c
Normal file
26
kattis/problems/06_11_23/pokechat/main.c
Normal 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;
|
||||
}
|
26
kattis/problems/06_11_23/pokechat/main.c.orig
Normal file
26
kattis/problems/06_11_23/pokechat/main.c.orig
Normal 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;
|
||||
}
|
BIN
kattis/problems/06_11_23/pokechat/program
Executable file
BIN
kattis/problems/06_11_23/pokechat/program
Executable file
Binary file not shown.
Reference in New Issue
Block a user