当前位置:网站首页>C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
2022-06-25 23:33:00 【Qin Sanma】
C2. k-LCM (hard version)
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
It is the hard version of the problem. The only difference is that in this version 3≤k≤n3≤k≤n.
You are given a positive integer nn. Find kk positive integers a1,a2,…,aka1,a2,…,ak, such that:
- a1+a2+…+ak=na1+a2+…+ak=n
- LCM(a1,a2,…,ak)≤n2LCM(a1,a2,…,ak)≤n2
Here LCMLCM is the least common multiple of numbers a1,a2,…,aka1,a2,…,ak.
We can show that for given constraints the answer always exists.
Input
The first line contains a single integer tt (1≤t≤104)(1≤t≤104) — the number of test cases.
The only line of each test case contains two integers nn, kk (3≤n≤1093≤n≤109, 3≤k≤n3≤k≤n).
It is guaranteed that the sum of kk over all test cases does not exceed 105105.
Output
For each test case print kk positive integers a1,a2,…,aka1,a2,…,ak, for which all conditions are satisfied.
Example
input
Copy
2 6 4 9 5
output
Copy
1 2 2 1 1 3 3 1 1
=========================================================================
c1 Adaptation of , Only need to k-3 Of 1 Deduction , hold n become n-(k-3), recycling c1 Conclusion ,3 The number represents the answer of any number demand
边栏推荐
- Live800 online customer service system: do business across time and space, starting from each interaction
- Once beego failed to find bee after passing the go get command Exe's pit
- 首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
- 头歌 第3关:使用线程锁(Lock)实现线程同步
- [Axi] interpretation of Axi protocol atomic access
- Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
- Konva series tutorial 2: drawing graphics
- jdbc常见异常及错误解决办法汇总
- [opencv450 samples] inpaint restores the selected region in the image using the region neighborhood
- Xampp重启后,MySQL服务就启动不了。
猜你喜欢

Live800 online customer service system: do business across time and space, starting from each interaction

24class static member

Kotlin空指针Bug

首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千

Why is the frame rate calculated by opencv wrong?

Pointer strengthening and improvement

Use of xinchida ble 5.0 Low Power Bluetooth module (at command serial port transparent transmission) rsbrs02abr

字符串

jdbc常见异常及错误解决办法汇总

【无标题】打开一个项目连接,无法正常显示时,ping一下ip
随机推荐
记一次beego通过go get命令后找不到bee.exe的坑
UE4 学习记录一 创建角色,并控制其移动
Live800在线客服系统:跨越时空做生意,从每次互动开始
Leetcode (605) -- flower planting
【AXI】解读AXI协议原子化访问
hiberate实体类CURD、事务操作汇总
jdbc常见异常及错误解决办法汇总
QComboBox下拉菜单中有分隔符Separator时的样式设置
Leetcode(605)——种花问题
#24class静态成员
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
Live800 online customer service system: do business across time and space, starting from each interaction
Konva series tutorial 2: drawing graphics
CDN加速是什么
My vscode
Core points of assembly language
What aspects should we start with in the feasibility analysis of dry goods?
Ble Low Power Bluetooth networking process and Bluetooth role introduction
关于go中资源泄漏/goroutine泄漏/内存泄漏/CPU打满等情况分析
Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)