1
0

Day 5-8 submissions

This commit is contained in:
2021-12-08 22:14:58 -05:00
parent 5689b82731
commit 533aae2f1c
8 changed files with 552 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#include <iostream>
using namespace std;
int main()
{
int next_fish;
unsigned long long fish[9] = {0};
for(int i = 0; i < 300; i++)
{
cin >> next_fish;
fish[next_fish]++;
}
unsigned long long total_fish = 300;
for(int i = 0; i < 256; i++)
{
unsigned long long spawning_fish = fish[0];
total_fish += spawning_fish;
for(int j = 1; j < 9; j++)
{
fish[j-1] = fish[j];
}
fish[6] += spawning_fish;
fish[8] = spawning_fish;
}
cout << total_fish << endl;
return 0;
}