In d5p1 also replaced int64_t with uint64_t.
This commit is contained in:
parent
7a19ad713f
commit
fbdc38a171
10
day5/p1.c
10
day5/p1.c
@ -31,7 +31,7 @@ int main(int argc, char **argv) {
|
||||
space_pos++;
|
||||
}
|
||||
|
||||
int64_t *data = (int64_t *) calloc(data_len, sizeof(int64_t));
|
||||
uint64_t *data = (uint64_t *) calloc(data_len, sizeof(uint64_t));
|
||||
bool *data_v = (bool *) calloc(data_len, sizeof(bool));
|
||||
|
||||
for (size_t i = 0, seeds_pos = (size_t) colon_pos+2;; seeds_pos++) {
|
||||
@ -48,8 +48,8 @@ int main(int argc, char **argv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int64_t dst = 0, src = 0, rng = 0;
|
||||
sscanf(line, "%ld %ld %ld\n", &dst, &src, &rng);
|
||||
uint64_t dst = 0, src = 0, rng = 0;
|
||||
sscanf(line, "%lu %lu %lu\n", &dst, &src, &rng);
|
||||
|
||||
for (size_t i = 0; i < data_len; ++i) {
|
||||
if (!data_v[i] && data[i] >= src && data[i] <= src+rng-1) {
|
||||
@ -61,12 +61,12 @@ int main(int argc, char **argv) {
|
||||
memset(line, 0, line_buf_length);
|
||||
}
|
||||
|
||||
int64_t lowest_loc_n = INT32_MAX;
|
||||
uint64_t lowest_loc_n = INT32_MAX;
|
||||
|
||||
for (size_t i = 0; i < data_len; ++i)
|
||||
lowest_loc_n = (data[i] < lowest_loc_n) ? data[i] : lowest_loc_n;
|
||||
|
||||
printf("%ld\n", lowest_loc_n);
|
||||
printf("%lu\n", lowest_loc_n);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user