Moved kattis from Uni repo
This commit is contained in:
30
kattis/problems/21_11_23/asciikassi/main.c
Normal file
30
kattis/problems/21_11_23/asciikassi/main.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void drawLine(int n) {
|
||||
printf("+");
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("-");
|
||||
}
|
||||
printf("+\n");
|
||||
}
|
||||
|
||||
void drawRect(int n) {
|
||||
drawLine(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("|");
|
||||
for (int j = 0; j < n; j++) {
|
||||
printf(" ");
|
||||
}
|
||||
printf("|\n");
|
||||
}
|
||||
drawLine(n);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n;
|
||||
scanf("%d", &n);
|
||||
|
||||
drawRect(n);
|
||||
return 0;
|
||||
}
|
45
kattis/problems/21_11_23/asciikassi/main.c.orig
Normal file
45
kattis/problems/21_11_23/asciikassi/main.c.orig
Normal file
@ -0,0 +1,45 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void drawRect(int n) {
|
||||
// Top part
|
||||
for (int i = 0; i <= n; i++) {
|
||||
if (i == 0 || i == n - 1) {
|
||||
printf("+");
|
||||
} else {
|
||||
printf("-");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
// Middle parts
|
||||
for (int i = 0; i < n - 2; i++) {
|
||||
for (int j = 0; j <= n; j++) {
|
||||
if (j == 0 || j == n - 1) {
|
||||
printf("|");
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// Bottom part
|
||||
for (int i = 0; i <= n; i++) {
|
||||
if (i == 0 || i == n - 1) {
|
||||
printf("+");
|
||||
} else {
|
||||
printf("-");
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n;
|
||||
scanf("%d", &n);
|
||||
|
||||
drawRect(n);
|
||||
return 0;
|
||||
}
|
BIN
kattis/problems/21_11_23/asciikassi/program
Executable file
BIN
kattis/problems/21_11_23/asciikassi/program
Executable file
Binary file not shown.
10
kattis/problems/21_11_23/modulo/1.in
Normal file
10
kattis/problems/21_11_23/modulo/1.in
Normal file
@ -0,0 +1,10 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
14
kattis/problems/21_11_23/modulo/main.c
Normal file
14
kattis/problems/21_11_23/modulo/main.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int counter = 0;
|
||||
for (int i=0; i<10; i++) {
|
||||
int n;
|
||||
scanf("%d", &n);
|
||||
if (n % 42 == 0) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
printf("%d\n", 10-counter);
|
||||
}
|
BIN
kattis/problems/21_11_23/modulo/program
Executable file
BIN
kattis/problems/21_11_23/modulo/program
Executable file
Binary file not shown.
17
kattis/problems/21_11_23/prjonamynstur/1.in
Normal file
17
kattis/problems/21_11_23/prjonamynstur/1.in
Normal file
@ -0,0 +1,17 @@
|
||||
16 16
|
||||
................
|
||||
...\O....OAO....
|
||||
................
|
||||
...\O..\O...O/..
|
||||
................
|
||||
...\O..\O...O/..
|
||||
................
|
||||
...\O.......O/..
|
||||
................
|
||||
....\O.....O/...
|
||||
................
|
||||
.....\O...O/....
|
||||
................
|
||||
......\O.O/.....
|
||||
................
|
||||
.......\O.......
|
4
kattis/problems/21_11_23/prjonamynstur/2.in
Normal file
4
kattis/problems/21_11_23/prjonamynstur/2.in
Normal file
@ -0,0 +1,4 @@
|
||||
3 5
|
||||
.....
|
||||
.....
|
||||
.....
|
33
kattis/problems/21_11_23/prjonamynstur/main.c
Normal file
33
kattis/problems/21_11_23/prjonamynstur/main.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n, m;
|
||||
scanf("%d %d", &n, &m);
|
||||
|
||||
int ingredients = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
|
||||
char c;
|
||||
scanf(" %c", &c);
|
||||
if (c == '.') {
|
||||
ingredients += 20;
|
||||
} else if (c == 'O') {
|
||||
ingredients += 10;
|
||||
} else if (c == '\\' || c == '/') {
|
||||
ingredients += 25;
|
||||
} else if (c == 'A') {
|
||||
ingredients += 35;
|
||||
} else if (c == '^') {
|
||||
ingredients += 5;
|
||||
} else if (c == 'v') {
|
||||
ingredients += 22;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%d\n", ingredients);
|
||||
|
||||
return 0;
|
||||
}
|
35
kattis/problems/21_11_23/prjonamynstur/main.c.orig
Normal file
35
kattis/problems/21_11_23/prjonamynstur/main.c.orig
Normal file
@ -0,0 +1,35 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n, m;
|
||||
scanf("%d %d", &n, &m);
|
||||
|
||||
int ingredients = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < m; j++) {
|
||||
|
||||
char c;
|
||||
scanf(" %c", &c);
|
||||
printf("%c", c);
|
||||
if (c == '.') {
|
||||
ingredients += 20;
|
||||
} else if (c == '0') {
|
||||
ingredients += 10;
|
||||
} else if (c == '\\' || c == '/') {
|
||||
ingredients += 25;
|
||||
} else if (c == 'A') {
|
||||
ingredients += 35;
|
||||
} else if (c == '^') {
|
||||
ingredients += 5;
|
||||
} else if (c == 'v') {
|
||||
ingredients += 22;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("%d\n\a", ingredients);
|
||||
|
||||
return 0;
|
||||
}
|
19
kattis/problems/21_11_23/prjonamynstur/main.py
Normal file
19
kattis/problems/21_11_23/prjonamynstur/main.py
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
n,m = [int(x) for x in input().split(" ")]
|
||||
ingredients = {
|
||||
'.': [20, 0],
|
||||
'O': [10, 0],
|
||||
'\\': [25, 0],
|
||||
'/': [25, 0],
|
||||
'A': [35, 0],
|
||||
'^': [5, 0],
|
||||
'v': [22, 0]
|
||||
}
|
||||
|
||||
for i in range(n):
|
||||
string = input()
|
||||
for token in string:
|
||||
ingredients[token][1] += 1
|
||||
|
||||
real_values = [x[0] * x[1] for x in ingredients.values()]
|
||||
print(sum(real_values))
|
BIN
kattis/problems/21_11_23/prjonamynstur/program
Executable file
BIN
kattis/problems/21_11_23/prjonamynstur/program
Executable file
Binary file not shown.
0
kattis/problems/21_11_23/sibice/1.in
Normal file
0
kattis/problems/21_11_23/sibice/1.in
Normal file
18
kattis/problems/21_11_23/sibice/main.c
Normal file
18
kattis/problems/21_11_23/sibice/main.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n, w, h;
|
||||
scanf("%d %d %d", &n, &w, &h);
|
||||
|
||||
for (int i=0; i<n; i++) {
|
||||
int l;
|
||||
scanf("%d", &l);
|
||||
if (l <= w || l <= h || l*l <= w*w + h*h) {
|
||||
printf("DA\n");
|
||||
} else {
|
||||
printf("NE\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
kattis/problems/21_11_23/sibice/program
Executable file
BIN
kattis/problems/21_11_23/sibice/program
Executable file
Binary file not shown.
4
kattis/problems/21_11_23/skolavslutningen/4.in
Normal file
4
kattis/problems/21_11_23/skolavslutningen/4.in
Normal file
@ -0,0 +1,4 @@
|
||||
3 5 5
|
||||
ABECE
|
||||
BCDAE
|
||||
CADBD
|
28
kattis/problems/21_11_23/skolavslutningen/main.c
Normal file
28
kattis/problems/21_11_23/skolavslutningen/main.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char getColumn(char hats[50][50], int n, int m, int column, char *result) {
|
||||
for (int i=0; i<n; i++) {
|
||||
result[i] = hats[i][column];
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int n, m, k;
|
||||
scanf("%d %d %d", &n, &m, &k);
|
||||
|
||||
char hats[50][50];
|
||||
|
||||
for (int i=0; i<n; i++) {
|
||||
for (int j=0; j<m; j++) {
|
||||
scanf(" %c", &hats[i][j]);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<n-1; i++) {
|
||||
for (int j=0; j<m; j++) {
|
||||
printf("%c ", hats[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
kattis/problems/21_11_23/skolavslutningen/program
Executable file
BIN
kattis/problems/21_11_23/skolavslutningen/program
Executable file
Binary file not shown.
Reference in New Issue
Block a user