https://codeforces.com/contest/1157/problem/D

题意:找到一个长度为k的元素大于0的数组,并且,整个数组的和等于n

题解:因为数组严格递增,数组最小和k*(k+1)/2,而i-n的最小和为(k-i+1)*(k-i+2)/2,对于这个公式可以加上一个首项,增加i-n的和,对第i个元素在i-n的和不应该大于剩下未分配的n,当然应该满足

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
ll t,n,m,k,p,l,r,u,v;
int ans,cnt,flag,temp,sum;
int a[N];
char str;
struct node{};
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    //scanf("%d",&t);
    //while(t--){
    scanf("%I64d%I64d",&n,&k);
    if(n<k*(k+1)/2){
        cout<<"NO"<<endl;
        return 0;
    }
    for(int i=1;i<=k;i++){
        ll base=(k-i+1ll)*(k-i+2ll)/2;
        ll num=max(1ll,i==1?(n-base)/(k-i+1ll)+1:min(2ll*a[i-1],(n-base)/(k-i+1ll)+1));
        //cout<<base<<" "<<num<<endl;
        if(num>a[i-1]&&(num<=a[i-1]*2||i==1)){
            n-=num;
            a[i]=num;
        }else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    if(n){
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    for(int i=1;i<=k;i++)
        printf("%d%c",a[i]," \n"[i==k]);
    //}

#ifdef DEBUG
	printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Hello world!" << endl;
    return 0;
}