## 1032 Parliament

7

3 4

```//////////////////////////////////////////////////////////////////////////
//        POJ1032 Parliament
//        Memory: 280K        Time: 0MS
//        Language: C++        Result: Accepted
//////////////////////////////////////////////////////////////////////////

#include <iostream>

using namespace std;

int main() {
int N;
cin >> N;
int cnt;
int sum = 0;
for (cnt = 0; sum + 2 + cnt<= N; ++cnt) {
sum += (2 + cnt);
}
int left = N - sum;
int p = 1 + cnt;
while (left > 0) {
--p;
--left;
}
if (p == 0) {
for (int i =3; i < 2 + cnt; ++i) {
cout << i << " ";
}
cout << 3 + cnt << endl;
} else if (p == 1) {
for (int i =3; i < 2 + cnt; ++i) {
cout << i << " ";
}
cout << 2 + cnt << endl;
} else if (p == cnt + 1) {
for (int i =2; i < 1 + cnt; ++i) {
cout << i << " ";
}
cout << 1 + cnt << endl;
} else {
for (int i =2; i <= p; ++i) {
cout << i << " ";
}
for (int i = p + 2; i < cnt + 2; ++i) {
cout << i << " ";
}
cout << 2 + cnt << endl;
}
system("pause");
return 0;
}```