#include <iostream>#include <time.h>#include <vector>using namespace std;int main(){int n, i, sub;vector <int> arr;srand((int)time(NULL));cin >> n;arr.push_back(n);arr.push_back(rand() % n + 1);sub = n - (rand() % n + 1);while (sub >= 0){arr.push_back(sub);sub = arr[arr.size() - 2] - arr[arr.size() - 1];}cout << arr.size() << endl;for (i = 0; i < arr.size(); i++)cout << arr[i] << " ";cout << endl;return 0;}
'백준' 카테고리의 다른 글
[11366] Tons of Orcs, no Fibbin’ (0) | 2018.08.24 |
---|---|
[11365] !밀비 급일 (0) | 2018.08.24 |
[4796] 캠핑 (0) | 2018.08.24 |
[11895] 속이기 (0) | 2018.08.23 |
[2456] 나는 학급회장이다 (0) | 2018.08.23 |