#P196. [Sleeping Cup #7] League Preparation

[Sleeping Cup #7] League Preparation

Person in Charge

Attention

The sample cases for this problem are not placed in subtask 0. Instead, they are located elsewhere:

Sample Data File Subtask ID Test Point
Sample 1 3.in / 3.out Subtask 2 #2-1
Sample 2 5.in / 5.out Subtask 3 #3-1

The subtask dependencies are as follows:

Subtask ID Depends on
Subtask 1 None
Subtask 2 Subtask 1
Subtask 3 Subtask 2
Subtask 4 Subtask 3

File I/O is required (league.in / league.out).

Problem Background

Last time, Sleeping Dolphin's good friend Sleeping Goose lost the match, so they began preparing for the 20702070 White Goose Planet World Cup 4545 years early, hoping to shine then.
To avoid another crushing defeat, the Sleeping Super League was born.

Problem Description

There are nn teams in the league.

Between any two matches there must be 33 days of rest, and at most one match per day can be held.
Calculate how many days a whole season lasts.

Input Format

Multiple test cases.

First line: an integer TT, the number of test cases.

For each test case:

One line with a positive integer nn, the number of teams.

Output Format

For each test case, output one integer: the number of days needed for the season.

Samples

3
1
2
3
0
5
21
3
10
100
1000
357
19797
1997997

Sample 1 Explanation

  • With 11 team, no matches can be played: output 00.
  • With 22 teams, matches (1,2)(1,2) and (2,1)(2,1) are required, scheduled on days 11 and 55 respectively: output 55.
  • With 33 teams, six matches are required: (1,2),(2,1),(1,3),(3,1),(2,3),(3,2)(1,2), (2,1), (1,3), (3,1), (2,3), (3,2), scheduled on days 1,5,9,13,17,211, 5, 9, 13, 17, 21: output 2121.

Data Range

For 100%100\% of the data, 1T501 \le T \le 50, 1n1091 \le n \le 10^9.

There are four equally-weighted subtasks:

  1. n=1n=1.
  2. n15n \le 15.
  3. n104n \le 10^4.
  4. No additional constraints.