Pizza Grows as You Slice It
Time limit1sMemory limit256 MB
For each K, choose the number of cuts that maximizes the pieces kept after giving away 1+2+...+k pieces to Yunhee.
- Level
Hard8 of 10
- Topics
- Math, Combinatorics, Geometry
- Solved
- No attempts yet
Problem
Yechan, on a diet for the new semester, is having a hard time. Too hungry from the diet, he decides to order a pizza. Wanting to savor the pizza for a long time, he plans to cut it into pieces with cuts () and then enjoy the pieces one by one. But only after the long-awaited pizza arrives does he realize that he has no knife. His friend Yunhee, who happens to have a knife, makes him this offer.
"I'll let you use my knife! But after you finish cutting the pizza, you give me one more piece for each cut. In other words, for 1 cut you give me 1 piece, for 2 cuts you add 2 more pieces for 3 pieces total, and for 3 cuts you add 3 more pieces for 6 pieces total."
Yechan, already on a diet, thinks Yunhee's offer is not bad and accepts it. But since he wants to savor the pizza for as long as possible, he wants to maximize the number of pizza pieces he eats. The size of the pieces does not matter, and each cut must be a straight line. Given the maximum number of cuts , find the maximum number of pizza pieces Yechan can eat!
Input
The first line gives the number of test cases as an integer. ()
The next lines give the test cases, one per line, and each test case gives the maximum number of cuts as an integer. ()
Output
For each test case, print the maximum number of pizza pieces Yechan can eat.