Moved kattis from Uni repo
This commit is contained in:
0
kattis/problems/13_11_23/platforme/main.c
Normal file
0
kattis/problems/13_11_23/platforme/main.c
Normal file
4
kattis/problems/13_11_23/sith/1.in
Normal file
4
kattis/problems/13_11_23/sith/1.in
Normal file
@ -0,0 +1,4 @@
|
||||
Obi-Wan Kenobi
|
||||
69
|
||||
80
|
||||
-11
|
4
kattis/problems/13_11_23/sith/3.in
Normal file
4
kattis/problems/13_11_23/sith/3.in
Normal file
@ -0,0 +1,4 @@
|
||||
Grogu
|
||||
67
|
||||
17
|
||||
50
|
21
kattis/problems/13_11_23/sith/main.c
Normal file
21
kattis/problems/13_11_23/sith/main.c
Normal 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;
|
||||
}
|
25
kattis/problems/13_11_23/sith/main.c.orig
Normal file
25
kattis/problems/13_11_23/sith/main.c.orig
Normal 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;
|
||||
}
|
BIN
kattis/problems/13_11_23/sith/program
Executable file
BIN
kattis/problems/13_11_23/sith/program
Executable file
Binary file not shown.
4
kattis/problems/13_11_23/vefthjonatjon/1.in
Normal file
4
kattis/problems/13_11_23/vefthjonatjon/1.in
Normal file
@ -0,0 +1,4 @@
|
||||
3
|
||||
J N N
|
||||
N J N
|
||||
N N J
|
3
kattis/problems/13_11_23/vefthjonatjon/2.in
Normal file
3
kattis/problems/13_11_23/vefthjonatjon/2.in
Normal file
@ -0,0 +1,3 @@
|
||||
2
|
||||
J J N
|
||||
N N J
|
35
kattis/problems/13_11_23/vefthjonatjon/main.c
Normal file
35
kattis/problems/13_11_23/vefthjonatjon/main.c
Normal 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;
|
||||
}
|
27
kattis/problems/13_11_23/vefthjonatjon/main.c.orig
Normal file
27
kattis/problems/13_11_23/vefthjonatjon/main.c.orig
Normal 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;
|
||||
}
|
17
kattis/problems/13_11_23/vefthjonatjon/main.py
Normal file
17
kattis/problems/13_11_23/vefthjonatjon/main.py
Normal 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))
|
BIN
kattis/problems/13_11_23/vefthjonatjon/program
Executable file
BIN
kattis/problems/13_11_23/vefthjonatjon/program
Executable file
Binary file not shown.
Reference in New Issue
Block a user