阅读程序:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include<iostream> using namespace std; int n,m,Max,c; int a[1000][1000]; int Minn(int x,int y,int z){ int res=x; if(res>y) res=y; if(res>z) res=z; return res; } int Square(int x,int y){ if(x==1) return a[x][y]; if(y==1) return a[x][y]; int res=a[x][y]+Minn(Square(x-1,y),Square(x,y-1),Square(x-1,y-1)); Max=max(Max,res); if(a[x][y]==0) res=0; return res; } int main (){ cin >> n >> m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin >> a[i][j]; } } Square(n,m); cout << Max; return 0; } |
0 of 6 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 6 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
2. 调用函数Minn(52,97,63),Minn函数返回的结果为97。 ( )
3. 输入0 0,会导致程序运行无法正常结束。 ( )
4. 输入如下数据,输出的结果为:
3 3
1 1 1
1 1 1
1 1 1
5. 输入数据如下,输出的结果为:
4 5
1 0 1 0 1
1 1 1 0 1
1 1 0 1 1
1 1 1 0 1
6. 程序的时间复杂度为