Skip to content

Commit 97e5e72

Browse files
authored
Create PE #11.cpp
1 parent 73d3edb commit 97e5e72

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

PE #11.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
#include<iostream>
3+
using namespace std;
4+
int main(){
5+
long long a[20][20],max=0,p;
6+
for(int i=0;i<20;i++){
7+
for(int j=0;j<20;j++){
8+
cin>>a[i][j];
9+
}
10+
}
11+
for(int i=0;i<20;i++){
12+
for(int j=0;j<=16;j++){
13+
p = a[i][j]*a[i][j+1]*a[i][j+2]*a[i][j+3];
14+
if(p> max) max=p;
15+
16+
p=a[j][i]*a[j+1][i]*a[j+2][i]*a[j+3][i];
17+
if(p> max) max=p;
18+
}
19+
}
20+
21+
22+
for(int i=0;i<17;i++){
23+
for(int j=0;j<17;j++){
24+
p= a[i][j]*a[i+1][j+1]*a[i+2][j+2]*a[i+3][j+3];
25+
if(p> max) max=p;
26+
}
27+
}
28+
for(int i=3;i<20;i++){
29+
for(int j=0;j<17;j++){
30+
31+
p=a[i][j]*a[i-1][j+1]*a[i-2][j+2]*a[i-3][j+3];
32+
if(p> max) max=p;
33+
}
34+
}
35+
36+
cout<<max;
37+
return 0;
38+
}

0 commit comments

Comments
 (0)