AMR10F - Cookies Piles

no tags 

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.


hide comments
pantd70: 2016-10-10 14:39:02

The main intension of problem is to make use of loop

Dushyant Singh: 2015-06-18 19:42:58

TLE in first attemp! *_*

akhil_sharma: 2012-06-20 07:11:48

WTF....this is spoj or smthing else

Last edit: 2012-06-20 07:12:24
ginnipkj: 2012-06-08 13:02:58

add to tutorial plz...........

Aradhya: 2011-12-30 15:56:11

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!!!

PubLic_AvenGeR: 2011-12-28 17:56:59

too easy..move to tutorial plz..

H. Gilles: 2011-12-27 23:37:35

http://en.wikipedia.org/wiki/Arithmetic_progression

Last edit: 2011-12-27 23:45:50
张翼德: 2011-12-09 13:25:47

I clicked on classical.. how the hell did I got redirected to tutorial -_-

Last edit: 2011-12-09 13:26:32
Mr. Rook: 2011-10-04 11:45:09

add this one to tutorial

Amit Chowdhary: 2011-09-10 12:37:55

Why am I getting a w/a here?? This is irritating, program seems to be working fine. :(


Added by:Varun Jalan
Date:2010-12-13
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64