View difference between Paste ID: dSc2T6kU and zE0mDA1m
SHOW: | | - or go back to the newest paste.
1
CPU: 2s
2
Memory: 2048MB
3
4
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.
5
6
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.
7
8
Write a program to help Jodu and Kodu to find the total weight remains after the first move of Jodu.
9
10
Input
11
12
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
13
14
Output
15
16
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).
17
18
Sample
19-
Input	Output
19+
20-
2 5 2 2 6 3 1 	Case 1: 10 Case 2: 15
20+
21
2
22
5 2 2
23
6 3 1 
24
25
Output
26
Case 1: 10
27
Case 2: 15