34 lines
622 B
C++
34 lines
622 B
C++
|
#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;
|
||
|
}
|