1
0
Fork 0
Advent2021/Day 1/Marcus/cpp/part2.cpp

22 lines
317 B
C++
Raw Normal View History

2021-12-09 06:11:44 +00:00
#include <iostream>
using namespace std;
int main()
{
int i1, i2, i3, i4, count=0;
cin >> i1 >> i2 >> i3;
while(cin >> i4)
{
if (i2+i3+i4 > i1+i2+i3) count++;
i1 = i2;
i2 = i3;
i3 = i4;
}
cout << count << endl;
return 0;
2021-12-02 05:25:07 +00:00
}