Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
Advertisement
Add Comment
Please, Sign In to add comment