Moved kattis from Uni repo
This commit is contained in:
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;
|
||||
}
|
Reference in New Issue
Block a user