Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. typedef long long ll;
  3. ll dp[100001][10];
  4. using namespace std;
  5.  
  6. ll can(ll i,ll j){
  7. return (j<10&&j>0?dp[i][j]:0);
  8. }
  9.  
  10. void pre_calc{
  11. for (int j=1;j<=9;j++){
  12. dp[1][j]=1;
  13. }
  14. for (int i=2;i<=100000;i++){
  15. for (int j=1;j<=9;j++){
  16. dp[i][j]=can(i,j+1)+can(i,j-1)+dp[i][j];
  17. }
  18. }
  19.  
  20. }
  21.  
  22. int main()
  23. {
  24. pre_calc;
  25.  
  26.  
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement