removed some includes
This commit is contained in:
parent
bb849bc054
commit
f79852dd93
2 changed files with 14 additions and 12 deletions
26
day6/day6a.c
26
day6/day6a.c
|
@ -1,27 +1,29 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define RACES 4
|
||||
#define RACES 1
|
||||
|
||||
int main()
|
||||
{
|
||||
// unsigned long int times[RACES] = {7, 15, 30};
|
||||
// unsigned long int distances[RACES] = {9, 40, 200};
|
||||
unsigned long int times[RACES] = {44, 80, 65, 72};
|
||||
unsigned long int distances[RACES] = {208, 1581, 1050, 1102};
|
||||
// unsigned long int times[RACES] = {44, 80, 65, 72};
|
||||
// unsigned long int distances[RACES] = {208, 1581, 1050, 1102};
|
||||
|
||||
// part c - set RACES to 1
|
||||
// unsigned long int times = 71530;
|
||||
// unsigned long int distances = 940200;
|
||||
unsigned long int times = 44806572;
|
||||
unsigned long int distances = 208158110501102;
|
||||
|
||||
unsigned long int numWins[RACES] = {0};
|
||||
unsigned long int range = 0;
|
||||
unsigned long int sum = 1;
|
||||
|
||||
for (unsigned long int i = 0; i < RACES; i++) {
|
||||
for (unsigned long int j = 0; j < times[i]; j++) {
|
||||
range = j * (times[i] - j);
|
||||
printf("%d = %d * (%d - %d)\n", range, j, times[i], j);
|
||||
if (range > distances[i]) numWins[i]++;
|
||||
for (unsigned long int j = 0; j < times; j++) {
|
||||
range = j * (times - j);
|
||||
// printf("%ul = %ul * (%ul - %ul)\n", range, j, times, j);
|
||||
if (range > distances) numWins[i]++;
|
||||
}
|
||||
if (numWins[i] > 0) sum *= numWins[i];
|
||||
}
|
||||
|
|
BIN
day6/run
BIN
day6/run
Binary file not shown.
Loading…
Reference in a new issue