Advertisement
Saleh127

CSES 1638

Apr 22nd, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll dp[1002][1002];
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11.  
  12. ll n,m,i,j,k,l=1e9+7;
  13.  
  14. cin>>n;
  15.  
  16. char a[n+2][n+2];
  17.  
  18. for(i=1;i<=n;i++)
  19. {
  20. for(j=1;j<=n;j++)
  21. {
  22. cin>>a[i][j];
  23. }
  24. }
  25.  
  26. for(i=1;i<=n;i++)
  27. {
  28. for(j=1;j<=n;j++)
  29. {
  30. if(a[i][j]=='*')
  31. {
  32. dp[i][j]=0;
  33. }
  34. else if(i==1 && j==1) dp[i][j]=1;
  35. else
  36. {
  37. dp[i][j]=(dp[i-1][j]+dp[i][j-1])%l;
  38.  
  39. }
  40. }
  41. }
  42.  
  43. cout<<dp[n][n]<<endl;
  44.  
  45. return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement