CF1690A.Print a Pedestal (Codeforces logo?)

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Given the integer nn — the number of available blocks. You must use all blocks to build a pedestal.

The pedestal consists of 33 platforms for 22-nd, 11-st and 33-rd places respectively. The platform for the 11-st place must be strictly higher than for the 22-nd place, and the platform for the 22-nd place must be strictly higher than for the 33-rd place. Also, the height of each platform must be greater than zero (that is, each platform must contain at least one block).

Example pedestal of n=11n=11 blocks: second place height equals 44 blocks, first place height equals 55 blocks, third place height equals 22 blocks.

Among all possible pedestals of nn blocks, deduce one such that the platform height for the 11-st place minimum as possible. If there are several of them, output any of them.

给定整数 nn —— 可用的方块总数。你必须使用全部方块来搭建一个领奖台。

该领奖台由三个平台组成,分别对应第二名、第一名和第三名。第一名平台的高度必须严格大于第二名平台的高度,第二名平台的高度必须严格大于第三名平台的高度。此外,每个平台的高度都必须大于零(即每个平台至少包含一个方块)。

一个由 n=11n=11 个方块构成的领奖台示例:第二名平台高度为 44 个方块,第一名平台高度为 55 个方块,第三名平台高度为 22 个方块。

在所有由 nn 个方块构成的可能领奖台中,找出一个使得第一名平台高度尽可能小的方案。若存在多个满足条件的方案,输出任意一个即可。

输入格式

The first line of input data contains an integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

Each test case contains a single integer nn (6≤n≤1056 \le n \le 10^5) — the total number of blocks for the pedestal. All nn blocks must be used.

It is guaranteed that the sum of nn values over all test cases does not exceed 10610^6.

输入数据的第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)—— 表示测试用例的数量。

每个测试用例包含一个整数 nn(6≤n≤1056 \le n \le 10^5)—— 表示基座所需的总方块数。所有 nn 个方块都必须被使用。

保证所有测试用例中 nn 的总和不超过 10610^6。

输出格式

For each test case, output 33 numbers h2,h1,h3h_2, h_1, h_3 — the platform heights for 22-nd, 11-st and 33-rd places on a pedestal consisting of nn blocks (h1+h2+h3=nh_1+h_2+h_3=n, 0<h3<h2<h10 \lt h_3 \lt h_2 \lt h_1).

Among all possible pedestals, output the one for which the value of h1h_1 minimal. If there are several of them, output any of them.

对于每个测试用例,输出三个数 h2,h1,h3h_2, h_1, h_3 —— 分别表示由 nn 个方块构成的领奖台中第二名、第一名和第三名所在平台的高度(满足 h1+h2+h3=nh_1+h_2+h_3=n,且 0<h3<h2<h10 \lt h_3 \lt h_2 \lt h_1)。

在所有可能的领奖台中,输出 h1h_1 最小的那个。若存在多个这样的解,输出其中任意一个即可。

输入输出样例

  • 输入#1

    6
    11
    6
    10
    100000
    7
    8

    输出#1

    4 5 2
    2 3 1
    4 5 1
    33334 33335 33331
    2 4 1
    3 4 1

说明/提示

In the first test case we can not get the height of the platform for the first place less than 55, because if the height of the platform for the first place is not more than 44, then we can use at most 4+3+2=94 + 3 + 2 = 9 blocks. And we should use 11=4+5+211 = 4 + 5 + 2 blocks. Therefore, the answer 4 5 2 fits.

In the second set, the only suitable answer is: 2 3 1.

在第一个测试用例中,我们无法使第一名平台的高度小于 55,因为如果第一名平台的高度不超过 44,那么最多只能使用 4+3+2=94 + 3 + 2 = 9 个方块;而我们需要恰好使用 11=4+5+211 = 4 + 5 + 2 个方块。因此,答案 4 5 24\ 5\ 2 是可行的。

在第二个测试用例中,唯一合适的答案是:2 3 12\ 3\ 1。

输入解题思路,AI测评打分。不知道怎么写?

首页