CF1095C.Powers Of Two
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A positive integer x is called a power of two if it can be represented as x=2y , where y is a non-negative integer. So, the powers of two are 1,2,4,8,16,… .
You are given two positive integers n and k . Your task is to represent n as the sum of exactly k powers of two.
输入格式
The only line of the input contains two integers n and k ( 1≤n≤109 , 1≤k≤2⋅105 ).
输出格式
If it is impossible to represent n as the sum of k powers of two, print NO.
Otherwise, print YES, and then print k positive integers b1,b2,…,bk such that each of bi is a power of two, and i=1∑kbi=n . If there are multiple answers, you may print any of them.
输入输出样例
输入#1
9 4
输出#1
YES 1 2 2 4
输入#2
8 1
输出#2
YES 8
输入#3
5 1
输出#3
NO
输入#4
3 7
输出#4
NO