nelson33

Untitled

Nov 10th, 2022
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | Source Code | 0 0
  1. #include<stdio.h>
  2. int k,m[15];
  3.  
  4. long long cal(int k){
  5.     if(m[k]>-1) return m[k];
  6.     else if(k==1){
  7.         m[k]=1;
  8.         return 1;
  9.     }
  10.     else if(k>1){
  11.         m[k]=cal(k-1)*8+1;
  12.         return m[k];
  13.     }
  14. }
  15.  
  16. int main(){
  17.     for(int i=1;i<15;i++) m[i]=-1;
  18.     scanf("%d",&k);
  19.     printf("%lld\n",cal(k));
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment