-
/* 수열의 합: N <= 1,000,000,000 2 <= L <= 100 a: 1항 d = 1(등차) */ #include <iostream> #define MAX_N 1,000,000,000 using namespace std; class sequence { private: int s = 0; int l = 0; int a = 0; int max = 0; public: sequence() { scanf("%d %d", &s, &l); } void seq() { int cntnum; if (s > MAX_N || l < 2 || l > 100) { return; } while (1) { a = ((2 * s) + (l - l*l)) / (2 * l); max = a; cntnum = a + 1; if (a < 0) { a = -1; return; } for (int i = 1; i < l; i++) { max = max + cntnum; cntnum++; if (max == s && i == l - 1) { return; } } l++; if (l > 100) { a = -1; return; } } } void show() { if (a < 0) { cout << "-1" << endl; return; } for (int i = 1; i < l; i++) { cout << a << " "; a++; } cout << a << endl; return; } }; int main() { sequence s1; s1.seq(); s1.show(); }