当前位置:网站首页>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;
}边栏推荐
- 【opencv450-samples】读取图像路径列表并保持比例显示
- The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
- Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
- Idea auto generator generates constructor get/set methods, etc
- Oracle -- table operation
- Pointer strengthening and improvement
- Fegin client entry test
- Multithreaded learning 1
- go中全类型等值判断解析&综合汇总
- Live800在线客服系统:跨越时空做生意,从每次互动开始
猜你喜欢

元宇宙标准论坛成立

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

UE4 学习记录一 创建角色,并控制其移动

konva系列教程2:绘制图形

Use and difference between ue4\ue5 blueprint node delay and retroggable delay

qtcreator 格式化代码

The applet draws a simple pie chart

What is Unified Extensible Firmware Interface (UEFI)?

What is Unified Extensible Firmware Interface (UEFI)?

论文笔记: 多标签学习 MSWL
随机推荐
论文笔记: 多标签学习 MSWL
qtcreator 格式化代码
Idea shortcut
Oracle - getting started
Leetcode(435)——无重叠区间
Repoptimizer: it's actually repvgg2
【opencv450 samples】创建图像列表yaml
记录一下Qt将少量图片输出为MP4的思路及注意事项
Core points of assembly language
Go语言逃逸分析全纪录
Baidu: in 2022, the top ten hot spots will rise and the profession will be released. There is no suspense about the first place!
[Axi] interpretation of Axi protocol atomic access
Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
牛客小白月賽52--E 分組求對數和(二分)
CDN加速是什么
My vscode
Multithreaded learning 1
Technology blog site collection
UE4_UE5结合offline voice recognition插件做语音识别功能
【2023校招刷题】番外篇1:度量科技FPGA岗(大致解析版)