Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int dp[101][101];
- int v[101][101];
- int main()
- {
- int n,m,i,j,max1;
- char a;
- cin>>n>>m;
- for(i=1;i<=n;i++){
- for(j=1;j<=m;j++){
- cin>>a;
- if(a=='#')
- v[i][j]=1;
- }
- }
- for(i=n;i>=1;i--){
- for(j=m;j>=1;j--){
- if(v[i][j]!=1){
- dp[i][j]=max(dp[i+1][j],dp[i][j+1])+1;
- }
- }
- }
- cout<<dp[1][1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement