当前位置:网站首页>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个数表示任意数字需求的答案即可
边栏推荐
- konva系列教程2:绘制图形
- The sum of logarithms in group 52--e of Niuke Xiaobai monthly race (two points)
- 自定义QComboBox下拉框,右对齐显示,下拉列表滑动操作
- Day3 data types and operators summary and job
- UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
- Flex & Bison 開始
- Pit resolution encountered using East OCR (compile LAMS)
- PDM fur
- Why is the frame rate calculated by opencv wrong?
- Qt 中文和英文分别使用不同的字体
猜你喜欢

leetcode_ 136_ A number that appears only once

ACM. HJ16 购物单 ●●

The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars

How to add cartoon characters to the blog park?

What is Unified Extensible Firmware Interface (UEFI)?

多台云服务器的 Kubernetes 集群搭建

Pycharm student's qualification expires, prompting no suitable licenses associated with account solution

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

剑指 Offer 46. 把数字翻译成字符串(DP)

1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
随机推荐
RepOptimizer: 其实是RepVGG2
Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
Set up your own website (15)
Live800在线客服系统:跨越时空做生意,从每次互动开始
How to download the software package of CDH version
【AXI】解读AXI协议原子化访问
STM32 development board + smart cloud aiot+ home monitoring and control system
Es6-- set
记一次beego通过go get命令后找不到bee.exe的坑
C language (I)
Windows安装Redis及简单使用
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
Windows redis installation and simple use
Es7/es9 -- new features and regularities
Jupiter notebook common shortcut keys
建立自己的网站(15)
【opencv450 samples】创建图像列表yaml
character string
#23class介绍
MySQL queries data by day, week, month, quarter and year