SHARE
TWEET

Untitled

a guest Mar 31st, 2015 190 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class RockPaperScissorsMagicEasy:              
  2.         def count(self, card, score):
  3.                 dp_arr = [ [0]*(score+1) for i in range(len(card)+1) ]
  4.                
  5.                 for i in range(1,len(card)+1):
  6.                         dp_arr[i][0] = 2**i
  7.                
  8.                 if(score>=1):
  9.                         dp_arr[1][1] = 1
  10.                        
  11.                 for i in range(2,score+1):
  12.                         dp_arr[1][i] = 0       
  13.                        
  14.                
  15.                
  16.                 for i in range(2,len(card)+1):
  17.                         for j in range(1,score+1):
  18.                                 dp_arr[i][j] = dp_arr[i-1][j-1] + dp_arr[i-1][j]*2
  19.                                 dp_arr[i][j] %= 1000000007
  20.                                
  21.                                
  22.                                
  23.                 return dp_arr[len(card)][score]
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
 
Top