#B3655. Active Value Accumulation in Daily Check-in
Active Value Accumulation in Daily Check-in
Active Value Accumulation in Daily Check-in
In the game "天天爱跑步", the company has implemented an active value system to reward players based on their consecutive sign-in streak. The reward on each day depends on the current consecutive sign-in count (which resets to 0 if a day is missed) and follows these thresholds:
- When the streak reaches 1 day: the reward changes from 0 to \(v_1\).
- When the streak reaches 3 days: the reward changes from \(v_1\) to \(v_3\).
- When the streak reaches 7 days: the reward changes from \(v_3\) to \(v_7\).
- When the streak reaches 30 days: the reward changes from \(v_7\) to \(v_{30}\).
- When the streak reaches 120 days: the reward changes from \(v_{30}\) to \(v_{120}\).
- When the streak reaches 365 days: the reward changes from \(v_{120}\) to \(v_{365}\).
- If the streak is \(366\) days or more, the reward remains \(v_{365}\) every day.
For each day that the player signs in (represented by a 1), the consecutive streak increases by 1 and the reward for that day is determined by the current streak. If the player does not sign in (represented by a 0), the streak resets to 0 and no reward is granted for that day.
Your task is to calculate the total active value reward accumulated by a super gamer over \(n\) days given the daily sign-in sequence.
Note: The reward for a signed-in day is determined as follows:
[ reward = \begin{cases} 0, & \text{if not signed in (or streak = 0)}\ v_{365}, & \text{if streak} \ge 365 \ v_{120}, & \text{if } 120 \leq \text{streak} < 365 \ v_{30}, & \text{if } 30 \leq \text{streak} < 120 \ v_{7}, & \text{if } 7 \leq \text{streak} < 30 \ v_{3}, & \text{if } 3 \leq \text{streak} < 7 \ v_{1}, & \text{if } 1 \leq \text{streak} < 3 \ \end{cases} ]
inputFormat
The input consists of multiple lines:
- The first line contains six integers:
v1 v3 v7 v30 v120 v365
, which represent the reward values corresponding to the thresholds. - The second line contains an integer \(n\) indicating the number of days.
- The third line contains \(n\) integers separated by spaces. Each integer is either 1 (signed in) or 0 (not signed in).
outputFormat
Output a single integer representing the total accumulated active value reward over the given \(n\) days.
sample
10 20 30 40 50 60
7
1 1 1 1 0 1 1
80