CF1430A.Number of Apartments
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Recently a new building with a new layout was constructed in Monocarp's hometown. According to this new layout, the building consists of three types of apartments: three-room, five-room, and seven-room apartments. It's also known that each room of each apartment has exactly one window. In other words, a three-room apartment has three windows, a five-room — five windows, and a seven-room — seven windows.
Monocarp went around the building and counted n windows. Now he is wondering, how many apartments of each type the building may have.
Unfortunately, Monocarp only recently has learned to count, so he is asking you to help him to calculate the possible quantities of three-room, five-room, and seven-room apartments in the building that has n windows. If there are multiple answers, you can print any of them.
Here are some examples:
- if Monocarp has counted 30 windows, there could have been 2 three-room apartments, 2 five-room apartments and 2 seven-room apartments, since 2⋅3+2⋅5+2⋅7=30;
- if Monocarp has counted 67 windows, there could have been 7 three-room apartments, 5 five-room apartments and 3 seven-room apartments, since 7⋅3+5⋅5+3⋅7=67;
- if Monocarp has counted 4 windows, he should have mistaken since no building with the aforementioned layout can have 4 windows.
最近,Monocarp 的家乡新建了一栋采用全新布局的建筑。根据这一新布局,该建筑包含三种类型的公寓:三居室、五居室和七居室公寓。此外,已知每套公寓的每个房间恰好有一扇窗户。换句话说,一套三居室公寓有 3 扇窗户,一套五居室公寓有 5 扇窗户,一套七居室公寓有 7 扇窗户。
Monocarp 绕着整栋建筑走了一圈,数出了 n 扇窗户。现在他想知道:该建筑中每种类型的公寓可能各有多少套?
遗憾的是,Monocarp 最近才刚刚学会计数,因此他请你帮忙计算出:当建筑共有 n 扇窗户时,三居室、五居室和七居室公寓各自的可能数量。若存在多种答案,输出任意一种即可。
以下是一些示例:
- 若 Monocarp 数得 30 扇窗户,则建筑中可能有 2 套三居室公寓、2 套五居室公寓和 2 套七居室公寓,因为 2⋅3+2⋅5+2⋅7=30;
- 若 Monocarp 数得 67 扇窗户,则建筑中可能有 7 套三居室公寓、5 套五居室公寓和 3 套七居室公寓,因为 7⋅3+5⋅5+3⋅7=67;
- 若 Monocarp 数得 4 扇窗户,则他一定数错了,因为按照上述布局,不存在仅有 4 扇窗户的建筑。
输入格式
Th first line contains one integer t (1≤t≤1000) — the number of test cases.
The only line of each test case contains one integer n (1≤n≤1000) — the number of windows in the building.
第一行包含一个整数 t(1≤t≤1000)——测试用例的数量。
每个测试用例仅有一行,包含一个整数 n(1≤n≤1000)——建筑物中窗户的数量。
输出格式
For each test case, if a building with the new layout and the given number of windows just can't exist, print −1.
Otherwise, print three non-negative integers — the possible number of three-room, five-room, and seven-room apartments. If there are multiple answers, print any of them.
对于每个测试用例,如果不存在满足新布局且具有给定窗户数量的大楼,则输出 −1。
否则,输出三个非负整数——分别为三居室、五居室和七居室公寓的可能数量。若存在多个答案,输出任意一个即可。
输入输出样例
输入#1
4 30 67 4 14
输出#1
2 2 2 7 5 3 -1 0 0 2
输入解题思路,AI测评打分。不知道怎么写?