Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CPU: 2s
- Memory: 2048MB
- Jodu and Kodu are two best friends and they like to play different games with each other. One day Jodu discovered an interesting two player game and asked Kodu to participate in the game.
- Jodu has N marbles each of unique weights from 1 to N and placed them in ascending order in front of them. At first move, Jodu will select K consecutive marbles (X, X+1, X+2 … X+K-1) starting from X and will remove them. Kodu will do the same as the second move of the game. Before the move Kodu wants to calculate, what is the total weight of the remaining marbles after Jodu‟s move. But Kodu is badly weak in mathematics, he don‟t know how to calculate sum of consecutive numbers.
- Write a program to help Jodu and Kodu to find the total weight remains after the first move of Jodu.
- Input
- First line of the input will contain an integer T(T<100), number of test cases to follow. Each of the next T lines will contain three integers N, K, X (0
- Output
- For each input, print the output in the format, Case X: Y (here, X is the test case number starting from 1 and Y is the answer).
- Sample
- Input Output
- 2 5 2 2 6 3 1 Case 1: 10 Case 2: 15
Advertisement
Add Comment
Please, Sign In to add comment