当前位置:网站首页>A. Print a Pedestal (Codeforces logo?)
A. Print a Pedestal (Codeforces logo?)
2022-06-29 21:35:00 【Felven】
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
Input
The first line of input data contains an integer tt (1≤t≤1041≤t≤104) — the number of test cases.
Each test case contains a single integer nn (6≤n≤1056≤n≤105) — 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 106106.
Output
For each test case, output 33 numbers h2,h1,h3h2,h1,h3 — the platform heights for 22-nd, 11-st and 33-rd places on a pedestal consisting of nn blocks (h1+h2+h3=nh1+h2+h3=n, 0<h3<h2<h10<h3<h2<h1).
Among all possible pedestals, output the one for which the value of h1h1 minimal. If there are several of them, output any of them.
Example
input
Copy
6 11 6 10 100000 7 8
output
Copy
4 5 2 2 3 1 4 5 1 33334 33335 33331 2 4 1 3 4 1
Note
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.
Problem solving instructions : This question can be constructed directly , Need make h1 As small as possible .
#include"stdio.h"
#include"math.h"
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int i, n, x, y;
scanf("%d", &n);
y = (n + 2) / 3;
y++;
n = n - y;
x = (n + 2) / 2;
printf("%d %d %d\n", x, y, (n - x));
}
return 0;
}边栏推荐
- How to call RFC function of ABAP on premises system directly in SAP BTP ABAP programming environment
- Selection of materials for space conductive disc slip ring
- STL tutorial 6-deque, stack, queue, list container
- 计算成像前沿进展
- 期末复习【微机原理】
- 导航 实验【微机原理】【实验】
- MES系统与ERP如何集成?本文告诉你答案
- Alibaba cloud released the atlas of China's robot industry (2022), 122 Pages pdf
- About Effect Size
- Exit operation in project
猜你喜欢

leetcode:238. Product of arrays other than itself

Alibaba cloud released the atlas of China's robot industry (2022), 122 Pages pdf

Design of VHDL telephone billing system
![Navigation [microcomputer principle]](/img/79/8311a409113331e72f650a83351b46.png)
Navigation [microcomputer principle]

Redis (I) -- getting started with redis (1) -- redis introduction, installation and startup, and common configurations

路由汇总带来的三层环路-解决实验

【ROS进阶篇】第四讲 ROS中的重名问题(节点、话题与参数)

What is a SYN Flood attack? How to protect?

leetcode:370. Interval addition

How to evaluate iFLYTEK AI translation pen P20 series? Is it worth buying?
随机推荐
STM32最小系统搭建(原理图)
Win10 add SSH public key
Rsync method of establishing multi directory module
Vipshop product details API interface (item_get- get vipshop product details interface), vipshop details API interface
透过华为军团看科技之变(五):智慧园区
Application of VoIP push in overseas audio and video services
企业实施MES系统的关键点详解
How to evaluate iFLYTEK AI translation pen P20 series? Is it worth buying?
Curl download example
一次 Keepalived 高可用的事故,让我重学了一遍它!
【云原生实战】KubeSphere实战——多租户系统实战
管理人员应具备的基本素质
Summary of document level symbols under different systems
Verilog realizes serial communication and sends it to the nixie tube
Realize inotify and Rsync real-time backup
[advanced ROS chapter] lesson 2 custom header and source file encapsulation
How to integrate MES system with ERP? This article tells you the answer
Win10添加ssh公钥
Shutter bottomnavigationbar toggle page hold
Change detection and batch update