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,4 @@
Obi-Wan Kenobi
69
80
-11

View File

@ -0,0 +1,4 @@
Grogu
67
17
50

View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int a, b, diff;
char c;
while ((c=getchar()) != '\n' ) {
continue;
}
scanf("%d %d %d", &a, &b, &diff);
if (abs(a-b) == diff && a - b != diff) {
printf("SITH\n");
} else if (a - b == diff && abs(a-b) != diff ) {
printf("JEDI\n");
} else {
printf("VEIT EKKI\n");
}
return 0;
}

View File

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
int absolute(int x) {
return x < 0 ? -x : x;
}
int main(int argc, char **argv) {
int a, b, diff;
char c;
while ((c=getchar()) != '\n' ) {
continue;
}
scanf("%d %d %d", &a, &b, &diff);
if (absolute(a-b) == diff) {
printf("SITH\n");
} else if (a - b == diff && absolute(a-b) != diff) {
printf("JEDI\n");
} else {
printf("VEIT EKKI\n");
}
return 0;
}

Binary file not shown.

View File

@ -0,0 +1,4 @@
3
J N N
N J N
N N J

View File

@ -0,0 +1,3 @@
2
J J N
N N J

View File

@ -0,0 +1,35 @@
#include <stdio.h>
#include <stdlib.h>
int isThere(char c) {
if (c == 'J') {
return 1;
}
return 0;
}
int main(int argc, char **argv) {
int n;
scanf("%d", &n);
int cpu = 0, memory = 0, disk = 0;
for (int i=0; i<n; i++) {
char c, m, d;
scanf("%c %c %c", &c, &m, &d);
if (isThere(c)) {
cpu++;
}
if (isThere(m)) {
memory++;
}
if (isThere(d)) {
disk++;
}
}
printf("%d %d %d\n", cpu, memory, disk);
printf("%d\n", cpu+memory+disk/3);
return 0;
}

View File

@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
int isThere(char c) {
if (c == 'J') return 1;
return 0;
}
int main(int argc, char **argv) {
int n;
scanf("%d", &n);
int cpu = 0, memory = 0, disk = 0;
for (int i=0; i<n; i++) {
char c, m, d;
scanf("%c %c %c", &c, &m, &d);
if (isThere(c)) cpu++;
if (isThere(m)) memory++;
if (isThere(d)) disk++;
}
printf("%d %d %d\n", cpu, memory, disk);
printf("%d\n", cpu+memory+disk/3);
return 0;
}

View File

@ -0,0 +1,17 @@
from math import floor
def increaseList(lst, c,m,d):
lst[0] += c
lst[1] += m
lst[2] += d
return lst
n = int(input())
c,m,d = (0,0,0)
for i in range(n):
cmd = [1 if x == "J" else 0 for x in input().split() ]
c,m,d = increaseList(cmd, c,m,d)
print(floor((c+m+d)/3))

Binary file not shown.