Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public long afisare(){
- long aux = 0;
- dp = new long[lungime][lungime];
- dp[1][0] = 1;
- for(int j = 1; j < lungime; j++){
- for(int i = 0; i < lungime; i++){
- if(charachets[j] == '^'){
- if(i == 0) {
- aux = dp[i+1][j-1];
- dp[i][j] = aux % val;
- } else
- if(i + 1 == lungime){
- } else {
- aux = (dp[i-1][j-1] + (i+1) * dp[i+1][j-1]);
- dp[i][j] = aux % val;
- }
- } else
- if(charachets[j] == '_'){
- aux = i * dp[i][j-1];
- dp[i][j] = aux % val;
- }
- }
- }
- return dp[0][lungime - 1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement