当前位置:网站首页>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 学习记录一 创建角色,并控制其移动
- After xampp restarts, the MySQL service cannot be started.
- 百度:2022年十大热度攀升专业出炉,第一名无悬念!
- Count the number of different palindrome subsequences in the string
- jdbc常见异常及错误解决办法汇总
- [Axi] interpretation of Axi protocol disorder mechanism
- Efr32bg22 ble module (low power Bluetooth communication module) at command test
- 我的vscode
- The sum of logarithms in group 52--e of Niuke Xiaobai monthly race (two points)
- 判断预约时间是否已经过期
猜你喜欢

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

UE4_ Ue5 combines the offline voice recognition plug-in for speech recognition

Problem recording and thinking

Circuit module analysis exercise 6 (switch)

konva系列教程2:绘制图形
![[Axi] interpretation of Axi protocol atomic access](/img/40/c742b861d92dfa2a1b27ae9ccc7a5d.png)
[Axi] interpretation of Axi protocol atomic access

Several optimization scenarios using like fuzzy retrieval in SQL

Actual combat: how to quickly change font color in typera (blog sharing - perfect) -2022.6.25 (solved)

电路模块分析练习5(电源)

字符串
随机推荐
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
NLP text summary: use the pre training model to perform text summary tasks [transformers:pipeline, T5, Bart, Pegasus]
Implementation of importing vscode from PDM
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
What aspects should we start with in the feasibility analysis of dry goods?
毕业旅行 | 伦敦5日游行程推荐
建立自己的网站(15)
Qt 中文和英文分别使用不同的字体
Basic operator
golang Make a list of intervals with sequential numbers
Pit resolution encountered using East OCR (compile LAMS)
Idea shortcut
牛客小白月賽52--E 分組求對數和(二分)
UE4_UE5結合offline voice recognition插件做語音識別功能
Idea FAQ collection
String对象(常量)池
ES6 -- formal parameter setting initial value, extension operator, iterator, and generating function
【ModuleBuilder】GP服务实现SDE中两个图层相交选取
Es6-- set
Konva series tutorial 2: drawing graphics