1
0

Day 9 submission

This commit is contained in:
2021-12-09 01:11:44 -05:00
parent 533aae2f1c
commit dfcc3b4f76
15 changed files with 850 additions and 723 deletions
+45
View File
@@ -0,0 +1,45 @@
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int height_map[100*100];
for(int i = 0; i < 100; i++)
{
string in;
cin >> in;
for(int j = 0; j < 100; j++)
{
height_map[j+i*100] = (int)in[j]-(int)'0';
}
}
int result = 0;
for(int i = 0; i < 100*100; i++)
{
if (i-100 >= 0 && height_map[i-100] <= height_map[i])
{
continue;
}
if (i+100 < 100*100 && height_map[i+100] <= height_map[i])
{
continue;
}
if (i-1 >= 0 && height_map[i-1] <= height_map[i])
{
continue;
}
if (i+1 < 100*100 && height_map[i+1] <= height_map[i])
{
continue;
}
result += height_map[i]+1;
}
cout << result << endl;
return 0;
}