当前位置:网站首页>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
边栏推荐
- UE4_UE5結合offline voice recognition插件做語音識別功能
- 统计字符串中不同回文子序列的个数
- Comp2913 database
- QLabel 文字水平滚动显示
- [Axi] interpretation of Axi protocol atomic access
- Kubernetes cluster construction of multiple ECS
- C. Planar Reflections-CodeCraft-21 and Codeforces Round #711 (Div. 2)
- [untitled] open an item connection. If it cannot be displayed normally, Ping the IP address
- Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
- Qt自定义实现的日历控件
猜你喜欢
Uni app -- listen for the exit of the return key
Visual studio code create minimal web API (asp.net core)
毕业旅行 | 伦敦5日游行程推荐
Pycharm student's qualification expires, prompting no suitable licenses associated with account solution
hiberate架构介绍及环境搭建(非常详细)
[untitled] open an item connection. If it cannot be displayed normally, Ping the IP address
Idea FAQ collection
UE4 学习记录一 创建角色,并控制其移动
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
经典图像分割网络:Unet 支持libtorch部署推理【附代码】
随机推荐
What is CDN acceleration
konva系列教程2:绘制图形
【无标题】打开一个项目连接,无法正常显示时,ping一下ip
Windows安装Redis及简单使用
指针强化与提高
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
Go语言逃逸分析全纪录
牛客小白月賽52--E 分組求對數和(二分)
经典图像分割网络:Unet 支持libtorch部署推理【附代码】
分享一个OSGeo4W64下载好的库,基于qgis3.10的
Ue4 Ue5 combine le plug - in de reconnaissance vocale de bureau pour la reconnaissance vocale
二进制、16进制、大端小端
问题记录与思考
My vscode
golang Make a list of intervals with sequential numbers
Windows redis installation and simple use
hiberate架构介绍及环境搭建(非常详细)
Count the number of different palindrome subsequences in the string
Comp212 distributed protocol
Circuit module analysis exercise 6 (switch)