fork(1) download
  1. // Errichto
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
  5. #define RI(i,n) FOR(i,1,(n))
  6. #define REP(i,n) FOR(i,0,(n)-1)
  7.  
  8. int main() {
  9. int s;
  10. scanf("%d", &s);
  11. if(s == 11) {
  12. puts("5");
  13. puts("21 14 8 17 1");
  14. return 0;
  15. }
  16. const int M = 1000 * 1000;
  17. if(s <= M) {
  18. puts("2");
  19. printf("%d %d\n", s, s);
  20. return 0;
  21. }
  22. vector<int> w;
  23. w.push_back(M);
  24. while(s >= M) {
  25. w.push_back(M);
  26. s -= M;
  27. }
  28. if(s) {
  29. w.push_back(1);
  30. --s;
  31. }
  32. if(s == 1) w.push_back(1);
  33. else if(s) for(int i = 0; i < 2; ++i) w.push_back(s-1);
  34. printf("%d\n", (int) w.size());
  35. for(int a : w) printf("%d ", a);
  36. puts("");
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
138
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1 520486 520486