Submit | All submissions | Best solutions | Back to list |
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?
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: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
|||||
2016-10-10 14:39:02
The main intension of problem is to make use of loop |
|||||
2015-06-18 19:42:58 Dushyant Singh
TLE in first attemp! *_* |
|||||
2012-06-20 07:11:48 akhil_sharma
WTF....this is spoj or smthing else Last edit: 2012-06-20 07:12:24 |
|||||
2012-06-08 13:02:58 ginnipkj
add to tutorial plz........... |
|||||
2011-12-30 15:56:11 Aradhya
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 17:56:59 PubLic_AvenGeR
too easy..move to tutorial plz.. |
|||||
2011-12-27 23:37:35 H. Gilles
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 |
|||||
2011-10-04 11:45:09 Mr. Rook
add this one to tutorial |
|||||
2011-09-10 12:37:55 Amit Chowdhary
Why am I getting a w/a here?? This is irritating, program seems to be working fine. :( |