Task DescriptionDiscussion (0)
In the first example, the tenth number displayed is 0, followed by 6 and 8. The sum is 14.
Task :: Displej
The game "display" is gaining popularity in casinos around the world. The game is run on a big screen visible to all players. A single integer is displayed on the screen, which changes every minute. The players attempt to determine the sum of K consecutive numbers, starting from the Bth displayed number. More precisely, if Xn is the nth number displayed (starting with X1), then players try to determine the sum XB + XB+1 + ... + XB+K−1. Mirko is thrilled with this game and often spends five or six hours calculating sums and growing in debt. Recently he realized that the numbers on screen follow a precise pattern; the same sequence of N integers repeats over and over.
Help Mirko to find the sought sum, given the sequence of number repeating.
Help Mirko to find the sought sum, given the sequence of number repeating.
INPUT:
The first line contains three integers N, K and B, 1 ≤ N ≤ 100, 1 ≤ K ≤ 100, 1 ≤ B ≤ 10^9.The second line contains N nonnegative integers less than 100, separated by spaces. This is the sequence that keeps repeating on screen.
The first line contains three integers N, K and B, 1 ≤ N ≤ 100, 1 ≤ K ≤ 100, 1 ≤ B ≤ 10^9.The second line contains N nonnegative integers less than 100, separated by spaces. This is the sequence that keeps repeating on screen.
OUTPUT:
Output the sum on a single line.
Output the sum on a single line.
Input
Output
6 3 10
29 6 35 0 6 8
29 6 35 0 6 8
Output
14
In the first example, the tenth number displayed is 0, followed by 6 and 8. The sum is 14.
Submit Solution
Available Languages
Task info
| Name: | Displej |
| Time: | 2.5 sec. |
| Memory: | 128 MB |
| #Tests: | 10 |
| AddedBy: | dario-dsa |
| Source: | Regional Competition 2008 |
Task Ratings
| Difficulty: | 2.8 (12 votes) |
| Quality: | 2.5 (11 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| matteo123 | 0 s. |
| 1010011010 | 0 s. |
| D.Ostojic | 0 s. |
| Al3kSaNdaR | 0 s. |
| crusader | 0 s. |
| A.Armin | 0 s. |
| halil | 0 s. |
| kole95 | 0 s. |
| afaji321 | 0 s. |
| tonkosi | 0 s. |
Solved By
Home
Training
Competitions
Forum
FAQ