Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Roll the Dice

By fire_tornado, fsshakkhor · Limits 1s, 512 MB

You have got a 6 sided dice. In a single roll, it may show any integers from 1 to 6. You are going to roll it exactly N times. In each roll, the integer shown on the top face of the dice will be added to your points.

You have to find out, what is the maximum and minimum number of points you can achieve after throwing the dice for exactly N times.


The first line contains an integer T (1 ≤ T ≤ 20), denoting the number of test cases.

Each of the next T lines will contain an integer N (0 ≤ N ≤ 20).


For each test case, print two integers separated by a space. These two integers represent the maximum and the minimum points you can earn by rolling the dice exactly N times.


12 2



98% Solution Ratio

vector94Earliest, Dec '19

vector94Fastest, 0.0s

vector94Lightest, 0 B

bokaifShortest, 41B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.