← All problemsSign in

Adding Up Sequences of Towers

CodeChefRating 3173Open on judge ↗

You are given an array A consisting of prime numbers greater than 4. Fun( Sequence S ) { if ( S has only 1 element ) return A[S[1]] X = S[2...last element] return power( A[S[1]] , Fun(X) ) } where power(A, B) returns AB, and A is 1-indexed. Fun(S) : Now you need to find the sum of the values returned by Fun(S) for every distinct sequence S. Each element of S is an integer from 1 to N. Thu

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start