Skip to content

Commit

Permalink
Create safety_deposit_boxes.c
Browse files Browse the repository at this point in the history
  • Loading branch information
rabestro authored May 4, 2020
1 parent c92ce81 commit e69d7ff
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions medium/pro-safety-deposit-boxes/safety_deposit_boxes.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <string.h>
#define MAX 300

int main() {
char boxes[MAX], item[MAX];
scanf("%s\n%s", boxes, item);

int time = 5;
for (char *box = strtok(boxes, ","); box; box = strtok(NULL, ","))
if (strcmp(item, box)) time += 5;
else break;

printf("%d", time);
return 0;
}

0 comments on commit e69d7ff

Please sign in to comment.