Replace uint32_t with uint64_t to support wider numbers.
This commit is contained in:
parent
fcabbd7dec
commit
57941c07ec
@ -23,13 +23,13 @@ int main(int argc, char **argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t total_copies = 0;
|
||||
uint64_t total_copies = 0;
|
||||
|
||||
size_t winning_numbers_len = 0;
|
||||
int8_t *winning_numbers = NULL;
|
||||
char *colon_pos = NULL, *pipe_pos = NULL;
|
||||
|
||||
uint32_t stack[STACK_SZ] = {0};
|
||||
uint64_t stack[STACK_SZ] = {0};
|
||||
uint8_t stack_pos = 0;
|
||||
|
||||
while (getline(&line, &line_length, input) != -1) {
|
||||
@ -45,7 +45,7 @@ int main(int argc, char **argv) {
|
||||
winning_numbers[i] = parse_number((char *)(wl_pos-1));
|
||||
}
|
||||
|
||||
uint32_t card_copies = 1 + stack[stack_pos++];
|
||||
uint64_t card_copies = 1 + stack[stack_pos++];
|
||||
|
||||
total_copies += card_copies;
|
||||
|
||||
@ -70,7 +70,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
free(winning_numbers);
|
||||
|
||||
printf("%d\n", total_copies);
|
||||
printf("%lu\n", total_copies);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user