当前位置:网站首页>C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
2022-06-25 22:01:00 【秦三马】
C1. k-LCM (easy version)
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
It is the easy version of the problem. The only difference is that in this version k=3k=3.
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, k=3k=3).
Output
For each test case print kk positive integers a1,a2,…,aka1,a2,…,ak, for which all conditions are satisfied.
Example
input
Copy
3 3 3 8 3 14 3
output
Copy
1 1 1 4 2 2 2 6 6
====================================================================================================
把3-100的数字全部打表打出来,答案基本上就能确定了,分奇偶讨论一下,每个人的规律不一定相同,满足条件即可
# include<iostream>
# include<cstring>
# include<queue>
# include<algorithm>
# include<math.h>
using namespace std;
# define mod 1000000007
typedef long long int ll;
int main ()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int k;
cin>>k;
if(n%3==0)
{
cout<<n/3<<" "<<n/3<<" "<<n/3<<endl;
}
else if(n%4==0)
{
cout<<n/2<<" "<<n/4<<" "<<n/4<<endl;
}
else
{
cout<<(n-1)/2<<" "<<(n-1)/2<<" "<<n-(n-1)/2*2<<endl;
}
}
return 0;
}边栏推荐
- UE4 学习记录一 创建角色,并控制其移动
- qtcreator 格式化代码
- Actual combat: how to quickly change font color in typera (blog sharing - perfect) -2022.6.25 (solved)
- 【无标题】打开一个项目连接,无法正常显示时,ping一下ip
- ACM. HJ16 购物单 ●●
- 1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
- 剑指 Offer 46. 把数字翻译成字符串(DP)
- Qt 中文和英文分别使用不同的字体
- 论文笔记: 多标签学习 MSWL
- pdm导入vscode的实现方式
猜你喜欢

Xinchida nd04 nd04c nrf52832 (52810) ble module (low power Bluetooth communication module) at command test

Circuit module analysis exercise 6 (switch)
2. What is the geometric meaning of a vector multiplying its transpose?

Qt自定义实现的日历控件

做接口测试,这3种工具到底什么时候用?

Pointer strengthening and improvement

百度:2022年十大热度攀升专业出炉,第一名无悬念!

UE4_UE5結合offline voice recognition插件做語音識別功能

Oracle -- table operation

Sword finger offer 46 Translate numbers to strings (DP)
随机推荐
【opencv450-samples】读取图像路径列表并保持比例显示
Ble Low Power Bluetooth networking process and Bluetooth role introduction
Go语言逃逸分析全纪录
Qt Utf8 与 Unicode 编码的互相转换, Unicode编码输出为格式为 &#xXXXX
Live800 online customer service system: do business across time and space, starting from each interaction
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
多台云服务器的 Kubernetes 集群搭建
OBS-Studio-27.2.4-Full-Installer-x64.exe 下载
CAD中图纸比较功能怎么用
记一次beego通过go get命令后找不到bee.exe的坑
【无标题】打开一个项目连接,无法正常显示时,ping一下ip
Day4 branch and loop summary and operation
Problem recording and thinking
做接口测试,这3种工具到底什么时候用?
【opencv450 samples】创建图像列表yaml
Transformers load pre training model
问题记录与思考
Basic operator
Sword finger offer 46 Translate numbers to strings (DP)
Technology blog site collection