当前位置:网站首页>C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
C1. k-LCM (easy version)-Codeforces Round #708 (Div. 2)
2022-06-25 23:33:00 【Qin Sanma】
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
====================================================================================================
hold 3-100 All the figures in the table are typed out , The answer is basically certain , Discuss parity , Everyone's rules are not necessarily the same , Meet the conditions
# 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;
}边栏推荐
- Day4 branch and loop summary and operation
- Why is the frame rate calculated by opencv wrong?
- ACM. HJ16 购物单 ●●
- Qt 中文和英文分别使用不同的字体
- Idea shortcut
- What aspects should we start with in the feasibility analysis of dry goods?
- 牛客小白月賽52--E 分組求對數和(二分)
- C language (I)
- Somme logarithmique (deux points) pour le Groupe 52 - - e de la course de la lune blanche de niuke
- After xampp restarts, the MySQL service cannot be started.
猜你喜欢

ACM. HJ16 购物单 ●●

Hbuilderx uses the gaude map to obtain the current location

Several optimization scenarios using like fuzzy retrieval in SQL

RK3568+鸿蒙工控板工业网关视频网关解决方案

Problem recording and thinking

hiberate核心API/配置文件/一级缓存详解

#23class介绍

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

Pointer strengthening and improvement

Qt 中文和英文分别使用不同的字体
随机推荐
UE4_UE5結合offline voice recognition插件做語音識別功能
记录一下Qt将少量图片输出为MP4的思路及注意事项
Idea shortcut
My C language learning process
QLabel 文字水平滚动显示
(serial port Lora module) centrida rf-al42uh private protocol test at instruction test communication process
Leetcode(435)——无重叠区间
Kubernetes cluster construction of multiple ECS
记一次beego通过go get命令后找不到bee.exe的坑
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
自定义QComboBox下拉框,右对齐显示,下拉列表滑动操作
B. Box Fitting-CodeCraft-21 and Codeforces Round #711 (Div. 2)
Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
UE4 学习记录二 给角色添加骨架,皮肤,及运动动画
Ad20 learning notes I
Why is BeanUtils not recommended?
Qt 中文和英文分别使用不同的字体
Comp212 distributed protocol
Typora writing DOS commands
cookie、session、token