SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int Dp[1005][2];
  6.  
  7. int main()
  8. {
  9.     int n,a,b;
  10.     cin>>n>>a>>b;
  11.  
  12.     Dp[1][0]=9;
  13.     if(a!=0)
  14.         Dp[1][0]--;
  15.     if(b!=0)
  16.         Dp[1][0]--;
  17.  
  18.     if(a!=0)
  19.         Dp[1][1]=1;
  20.     else
  21.         Dp[1][1]=0;
  22.  
  23.     for(int i=2; i<=n; i++)
  24.     {
  25.         Dp[i][0]=8*Dp[i-1][0];
  26.         Dp[i][1]=Dp[i-1][0]+9*Dp[i-1][1];
  27.     }
  28.     cout<<Dp[n][1]<<"\n";
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top