Guest User

Untitled

a guest
Dec 9th, 2019
104
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream cin("alice_xi.in");
  5. ofstream cout("alice_xi.out");
  6. int n,a[36][36];
  7. unsigned long long s=0;
  8. int main()
  9. {
  10. cin>>n;
  11. /*a[1][1]=1;
  12. a[2][1]=1;
  13. a[2][2]=1;*/
  14. for(int i=1;i<=n;i++)
  15. for(int j=1;j<=i;j++)
  16. if((i==1&&j==1)||(i==2&&j==2)||(i==2&&j==1))a[i][j]=1;
  17. else a[i][j]+=a[i-1][j]+a[i-1][j+1]+a[i-1][j-1];
  18.  
  19.  
  20. //else a[i][j]+=a[i-1][j]
  21.  
  22. for(int j=1;j<=n;j++)
  23. s+=a[n][j];
  24. cout<<s;
  25. /*for(int i=1;i<=n;i++)
  26. {
  27. cout<<endl;
  28.  
  29. for(int j=1;j<=i;j++)
  30. {
  31. cout<<a[i][j]<<" ";
  32. }
  33. }*/
  34. return 0;
  35. }
RAW Paste Data