Sphere Online Judge

SPOJ Problem Set (tutorial)

8060. Cookies Piles

Problem code: AMR10F

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?
 
INPUT
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
Output T lines, each line containing the required answer for the corresponding test case.
 
CONSTRAINTS
T <= 100
1 <= N, A, D <=100
 
SAMPLE INPUT
3
1 1 1
3 5 6
2 1 2
 
SAMPLE OUTPUT
1
33
4
 
EXPLANATION
In the second test case the sequence is: 5, 11, 17 whose sum is 33.


Added by:Varun Jalan
Date:2010-12-13
Time limit:2s
Source limit:50000B
Memory limit:256MB
Cluster: Pyramid (Intel Pentium III 733 MHz)
Languages:All

hide comments
2012-06-20 09:11:48 akhil_sharma
WTF....this is spoj or smthing else

Last edit: 2012-06-20 09:12:24
2012-06-08 15:02:58 ginnipkj
add to tutorial plz...........
2011-12-30 16:56:11 Say Hello to Daddy !
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!!!
2011-12-28 18:56:59 PubLic_AvenGeR
too easy..move to tutorial plz..
2011-12-28 00:37:35 H. Gilles
http://en.wikipedia.org/wiki/Arithmetic_progression

Last edit: 2011-12-28 00:45:50
2011-12-09 14:25:47 Swarn Avinash
I clicked on classical.. how the hell did I got redirected to tutorial -_-

Last edit: 2011-12-09 14:26:32
2011-10-04 13:45:09 Mr. Rook
add this one to tutorial
2011-09-10 14:37:55 Amit Chowdhary
Why am I getting a w/a here?? This is irritating, program seems to be working fine. :(
2011-06-26 18:31:29 SPOJ
Tutorial for sure!
2011-05-11 15:03:55 Rohan Kalra
Tutorial!
SPOJ © 2013 Sphere Research Labs. All Rights Reserved.