1
0
Fork 0

Day 1 submission

This commit is contained in:
Marcus Penate 2021-12-02 00:25:07 -05:00
parent e5c50e0331
commit aef9bb0262
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#include <iostream>
using namespace std;
int main()
{
int i1, i2, count=0;
cin >> i1;
while(cin >> i2)
{
if (i2 > i1) count++;
i1 = i2;
}
cout << count << endl;
return 0;
}

View File

@ -0,0 +1,22 @@
#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;
}