codeforces-scrape

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

402A.md (1844B)


      1 Source: https://codeforces.com/problemset/problem/402/A
      2 
      3 A. Nuts
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 You have *a* nuts and lots of boxes. The boxes have a wonderful feature: if you put *x* (*x* ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into *x* + 1 sections.
     22 
     23 You are minimalist. Therefore, on the one hand, you are against dividing some box into more than *k* sections. On the other hand, you are against putting more than *v* nuts into some section of the box. What is the minimum number of boxes you have to use if you want to put all the nuts in boxes, and you have *b* divisors?
     24 
     25 Please note that you need to minimize the number of used boxes, not sections. You do not have to minimize the number of used divisors.
     26 
     27 Input
     28 
     29 The first line contains four space-separated integers *k*, *a*, *b*, *v* (2 ≤ *k* ≤ 1000; 1 ≤ *a*, *b*, *v* ≤ 1000) — the maximum number of sections in the box, the number of nuts, the number of divisors and the capacity of each section of the box.
     30 
     31 Output
     32 
     33 Print a single integer — the answer to the problem.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 3 10 3 3
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 2
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 3 10 1 3
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 3
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 100 100 1 1000
     65 ```
     66 
     67 Output
     68 
     69 ```
     70 1
     71 ```
     72 
     73 Note
     74 
     75 In the first sample you can act like this:
     76 
     77 * Put two divisors to the first box. Now the first box has three sections and we can put three nuts into each section. Overall, the first box will have nine nuts.
     78 * Do not put any divisors into the second box. Thus, the second box has one section for the last nut.
     79 
     80 In the end we've put all the ten nuts into boxes.
     81 
     82 The second sample is different as we have exactly one divisor and we put it to the first box. The next two boxes will have one section each.