Club Schedule
InterviewTime limit1sMemory limit128 MB
Count attendance and key-passing schedules over N days where each day's leader attends and the key stays with attendees.
- Level
Medium5 of 10
- Topics
- Dynamic programming, Combinatorics
- Solved
- No attempts yet
Problem
Three members J, O, I attend club activities for days. Each day has 8 attendance patterns. J starts with the key. The daily leader must attend, some attendee must hold the key, and someone present takes the key home. Count valid schedules modulo 10007.
Input
Line 1: . Line 2: length- leader string over J, O, I.
Output
Print the count modulo 10007.