AMR10F - Cookies Piles
The kids in my son's kindergarten made Christmas cookies with their teacher, and piled them up in columns. They then arranged the columns so that the tops of the columns, going from shortest to tallest, were in a nice straight ramp. The cookies were all of uniform size. Given that there were A cookies in the shortest pile, that the difference in height between any two adjacent piles was D cookies, and that there were N piles, can you write a program to figure out how many cookies there were in total?
The first line contains the number of test cases T. T lines follow, one corresponding to each test case, containing 3 integers : N, A and D.
Output T lines, each line containing the required answer for the corresponding test case.
T <= 100
1 <= N, A, D <=100
1 1 1
3 5 6
2 1 2
In the second test case the sequence is: 5, 11, 17 whose sum is 33.
The main intension of problem is to make use of loop
TLE in first attemp! *_*
WTF....this is spoj or smthing elseLast edit: 2012-06-20 07:12:24
add to tutorial plz...........
vry simple problem....plzzz move 2 tutorial.. by seeing this prb I wonder that I am doing spoj or smthng else!!!...solvd in 1 min...lolzzzz!!!
too easy..move to tutorial plz..
http://en.wikipedia.org/wiki/Arithmetic_progressionLast edit: 2011-12-27 23:45:50
I clicked on classical.. how the hell did I got redirected to tutorial -_-Last edit: 2011-12-09 13:26:32
add this one to tutorial
Why am I getting a w/a here?? This is irritating, program seems to be working fine. :(