当前位置:网站首页>C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
C2. k-LCM (hard version)-Codeforces Round #708 (Div. 2)
2022-06-25 22:01:00 【秦三马】
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的改编,只需要把k-3的1扣掉,把n变成n-(k-3),再利用c1结论,3个数表示任意数字需求的答案即可
边栏推荐
- What is Unified Extensible Firmware Interface (UEFI)?
- New network security competition of the secondary vocational group in 2022
- Es6-- set
- Windows安装Redis及简单使用
- Basic operator
- MySQL queries data by day, week, month, quarter and year
- Leetcode(435)——无重叠区间
- Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
- RK3568+鸿蒙工控板工业网关视频网关解决方案
- Comp212 distributed protocol
猜你喜欢
ES6 - numerical extension and object extension
Paper notes: multi tag learning MSWl
qtcreator 格式化代码
jdbc常见异常及错误解决办法汇总
How to solve the problem of SQL?
ES6 const constants and array deconstruction
LM small programmable controller software (based on CoDeSys) note XVII: PTO pulse function block
电路模块分析练习6(开关)
Actual combat: how to quickly change font color in typera (blog sharing - perfect) -2022.6.25 (solved)
ES6 learning -- let
随机推荐
指针强化与提高
NLP text summary: use the pre training model to perform text summary tasks [transformers:pipeline, T5, Bart, Pegasus]
PDM fur
jdbc常见异常及错误解决办法汇总
pdm导入vscode的实现方式
Day4 branch and loop summary and operation
Pit resolution encountered using East OCR (compile LAMS)
cookie、session、token
1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
Basic operator
Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
转载: QTableWidget详解(样式、右键菜单、表头塌陷、多选等)
QLabel 文字水平滚动显示
Multithreaded learning 2- call control
#24class静态成员
Xampp重启后,MySQL服务就启动不了。
电路模块分析练习5(电源)
Rk3568+ Hongmeng industrial control board industrial gateway video gateway solution
干货丨产品的可行性分析要从哪几个方面入手?
character string