1
0
Fork 0

02: Solve in C

This commit is contained in:
Mia Herkt 2022-12-02 15:31:24 +01:00
parent be7fa3b032
commit f907f0611c
Signed by: mia
GPG Key ID: 72E154B8622EC191
2 changed files with 2515 additions and 0 deletions

2500
02/input Normal file

File diff suppressed because it is too large Load Diff

15
02/solution.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main(void) {
char e, p;
int s = 0, g = 0;
while(scanf("%c %c\n", &e, &p) == 2) {
e -= '@';
p -= 'W';
s += p + (p == e + 1 || p == e - 2 ? 2 : p == e) * 3;
g += (p - 1) * 3 + (p == 3 ? e > 2 ? 1 : e + 1 : p == 2 ? e : e < 2 ? 3 : e - 1);
}
printf("Silver: %d\nGold: %d\n", s, g);
}