codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

753A.md (1047B)


      1 Source: https://codeforces.com/problemset/problem/753/A
      2 
      3 A. Santa Claus and Candies
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Santa Claus has *n* candies, he dreams to give them as gifts to children.
     22 
     23 What is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of candies. Santa Class wants to give all *n* candies he has.
     24 
     25 Input
     26 
     27 The only line contains positive integer number *n* (1 ≤ *n* ≤ 1000) — number of candies Santa Claus has.
     28 
     29 Output
     30 
     31 Print to the first line integer number *k* — maximal number of kids which can get candies.
     32 
     33 Print to the second line *k* distinct integer numbers: number of candies for each of *k* kid. The sum of *k* printed numbers should be exactly *n*.
     34 
     35 If there are many solutions, print any of them.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 5
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 2  
     49 2 3
     50 ```
     51 
     52 Input
     53 
     54 ```
     55 9
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 3  
     62 3 5 1
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 2
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 1  
     75 2
     76 ```